use of org.eclipse.swt.layout.FormData in project tdi-studio-se by Talend.
the class LoginProjectPage method layoutControl.
@Override
protected void layoutControl() {
/**
* 2. Layout all the control
*/
super.layoutControl();
FormData formData = null;
/**
* 2.1 Layout Bottom Navigation Area
*/
layoutNavigatorArea();
/**
* 2.2 Layout Connection Area
*/
formData = new FormData();
formData.top = new FormAttachment(0, 0);
formData.left = new FormAttachment(0, 0);
title.setLayoutData(formData);
formData = new FormData();
formData.top = new FormAttachment(title, TAB_VERTICAL_PADDING_LEVEL_2, SWT.BOTTOM);
formData.left = new FormAttachment(0, 0);
formData.right = new FormAttachment(100, 0);
connectionManageArea.setLayoutData(formData);
GridLayout gridLayout = new GridLayout(2, true);
gridLayout.horizontalSpacing = TAB_HORIZONTAL_PADDING_LEVEL_2;
gridLayout.verticalSpacing = 0;
gridLayout.marginHeight = 0;
gridLayout.marginWidth = 0;
connectionManageArea.setLayout(gridLayout);
// formData = new FormData();
// formData.top = new FormAttachment(title, TAB_VERTICAL_PADDING_LEVEL_2, SWT.BOTTOM);
// formData.right = new FormAttachment(100, 0);
// formData.left = new FormAttachment(100, -1 * LoginDialogV2.getNewButtonSize(manageButton).x);
// manageButton.setLayoutData(formData);
GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, true);
manageButton.setLayoutData(gridData);
// formData = new FormData();
// formData.top = new FormAttachment(manageButton, 0, SWT.CENTER);
// formData.bottom = new FormAttachment(manageButton, 0, SWT.CENTER);
// formData.left = new FormAttachment(title, 0, SWT.LEFT);
// formData.right = new FormAttachment(manageButton, -1 * TAB_HORIZONTAL_PADDING_LEVEL_2, SWT.LEFT);
// connectionsViewer.getControl().setLayoutData(formData);
gridData = new GridData(SWT.FILL, SWT.CENTER, true, true);
connectionsViewer.getControl().setLayoutData(gridData);
connectionsViewer.setContentProvider(ArrayContentProvider.getInstance());
connectionsViewer.setLabelProvider(new ConnectionLabelProvider());
/**
* 2.3 Layout Project Operation Area
*/
int operationButtonPadding = 6;
formData = new FormData();
// formData.top = new FormAttachment(manageButton, 0, SWT.BOTTOM);
formData.top = new FormAttachment(connectionManageArea, 0, SWT.BOTTOM);
formData.bottom = new FormAttachment(navigateArea, 0, SWT.TOP);
// formData.left = new FormAttachment(connectionsViewer.getControl(), 0, SWT.LEFT);
formData.left = new FormAttachment(connectionManageArea, 0, SWT.LEFT);
formData.right = new FormAttachment(100, 0);
projectOperationArea.setLayout(new FormLayout());
projectOperationArea.setLayoutData(formData);
formData = new FormData();
formData.bottom = new FormAttachment(100, -1 * TAB_VERTICAL_PADDING_LEVEL_1);
formData.left = new FormAttachment(0, 0);
createSandBoxProject.setLayoutData(formData);
formData = new FormData();
formData.top = new FormAttachment(createSandBoxProject, 0, SWT.CENTER);
formData.bottom = new FormAttachment(createSandBoxProject, 0, SWT.CENTER);
formData.right = new FormAttachment(100, -1 * TAB_HORIZONTAL_PADDING_LEVEL_1);
formData.width = LoginDialogV2.getNewButtonSize(executeCreateSandBoxProject, operationButtonPadding).x;
executeCreateSandBoxProject.setLayoutData(formData);
formData = new FormData();
formData.bottom = new FormAttachment(createSandBoxProject, -1 * TAB_VERTICAL_PADDING_LEVEL_1, SWT.TOP);
formData.left = new FormAttachment(0, 0);
importLocalProject.setLayoutData(formData);
formData = new FormData();
formData.top = new FormAttachment(importLocalProject, 0, SWT.CENTER);
formData.bottom = new FormAttachment(importLocalProject, 0, SWT.CENTER);
formData.right = new FormAttachment(100, -1 * TAB_HORIZONTAL_PADDING_LEVEL_1);
formData.width = LoginDialogV2.getNewButtonSize(executeImportLocalProject, operationButtonPadding).x;
executeImportLocalProject.setLayoutData(formData);
formData = new FormData();
formData.bottom = new FormAttachment(importLocalProject, -1 * TAB_VERTICAL_PADDING_LEVEL_1, SWT.TOP);
formData.left = new FormAttachment(0, 0);
importDemoProject.setLayoutData(formData);
formData = new FormData();
formData.top = new FormAttachment(importDemoProject, 0, SWT.CENTER);
formData.bottom = new FormAttachment(importDemoProject, 0, SWT.CENTER);
formData.right = new FormAttachment(100, -1 * TAB_HORIZONTAL_PADDING_LEVEL_1);
formData.width = LoginDialogV2.getNewButtonSize(executeImportDemoProject, operationButtonPadding).x;
executeImportDemoProject.setLayoutData(formData);
formData = new FormData();
formData.bottom = new FormAttachment(importDemoProject, -1 * TAB_VERTICAL_PADDING_LEVEL_1, SWT.TOP);
formData.left = new FormAttachment(0, 0);
createNewProject.setLayoutData(formData);
formData = new FormData();
formData.top = new FormAttachment(createNewProject, 0, SWT.CENTER);
formData.bottom = new FormAttachment(createNewProject, 0, SWT.CENTER);
formData.right = new FormAttachment(100, -1 * TAB_HORIZONTAL_PADDING_LEVEL_1);
formData.width = LoginDialogV2.getNewButtonSize(executeCreateNewProject, operationButtonPadding).x;
executeCreateNewProject.setLayoutData(formData);
formData = new FormData();
formData.top = new FormAttachment(createNewProject, 0, SWT.CENTER);
formData.bottom = new FormAttachment(createNewProject, 0, SWT.CENTER);
formData.right = new FormAttachment(executeCreateNewProject, -1 * TAB_HORIZONTAL_PADDING_LEVEL_2, SWT.LEFT);
formData.left = new FormAttachment(createNewProject, TAB_HORIZONTAL_PADDING_LEVEL_2, SWT.RIGHT);
newProjectName.setLayoutData(formData);
formData = new FormData();
formData.top = new FormAttachment(0, TAB_VERTICAL_PADDING_LEVEL_1);
formData.left = new FormAttachment(0, 0);
selectExistingProject.setLayoutData(formData);
formData = new FormData();
formData.left = new FormAttachment(0, TAB_HORIZONTAL_PADDING_LEVEL_1);
formData.right = new FormAttachment(100, 0);
formData.top = new FormAttachment(selectExistingProject, TAB_VERTICAL_PADDING_LEVEL_2, SWT.BOTTOM);
formData.bottom = new FormAttachment(createNewProject, -1 * TAB_VERTICAL_PADDING_LEVEL_1, SWT.TOP);
projectListArea.setLayoutData(formData);
layoutProjectListArea();
}
use of org.eclipse.swt.layout.FormData in project tdi-studio-se by Talend.
the class LoginProjectPage method refreshNecessaryVisible.
protected void refreshNecessaryVisible(boolean isRemote) {
boolean isSVNPluginLoaded = PluginChecker.isSVNProviderPluginLoaded();
refreshCreateSandboxProjectVisible(isNeedSandboxProject());
refreshImportLocalProjectVisible(!isRemote);
refreshImportDemoProjectVisible(!isRemote);
refreshCreateNewProjectVisible(!isRemote);
refreshBranchAreaVisible(isSVNPluginLoaded && isRemote);
Control projectListAreaBottomControl = null;
if (isSVNPluginLoaded) {
if (isRemote) {
if (isNeedSandboxProject()) {
projectListAreaBottomControl = createSandBoxProject;
} else {
projectListAreaBottomControl = navigateArea;
}
}
}
if (projectListAreaBottomControl == null) {
projectListAreaBottomControl = createNewProject;
}
FormData formData = (FormData) projectListArea.getLayoutData();
if (projectListAreaBottomControl == navigateArea) {
formData.bottom = new FormAttachment(100, -1 * TAB_VERTICAL_PADDING_LEVEL_1);
} else {
formData.bottom = new FormAttachment(projectListAreaBottomControl, -1 * TAB_VERTICAL_PADDING_LEVEL_1, SWT.TOP);
}
projectOperationArea.layout();
projectOperationArea.update();
}
use of org.eclipse.swt.layout.FormData 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.layout.FormData in project tdi-studio-se by Talend.
the class LoginProjectPage method refreshCreateSandboxProjectVisible.
protected void refreshCreateSandboxProjectVisible(boolean visible) {
createSandBoxProject.setVisible(visible);
FormData formData = (FormData) createSandBoxProject.getLayoutData();
if (visible) {
formData.height = -1;
formData.bottom.offset = -1 * TAB_VERTICAL_PADDING_LEVEL_1;
} else {
formData.height = 0;
formData.bottom.offset = 0;
}
}
use of org.eclipse.swt.layout.FormData in project tdi-studio-se by Talend.
the class LoginProjectPage method layoutProjectListArea.
protected void layoutProjectListArea() {
projectListArea.setLayout(new FormLayout());
FormData formData = null;
/**
* BranchArea layout
*/
formData = new FormData();
formData.left = new FormAttachment(0, TAB_HORIZONTAL_PADDING_LEVEL_3);
formData.right = new FormAttachment(100, 0);
formData.bottom = new FormAttachment(100, 0);
branchArea.setLayoutData(formData);
branchArea.setLayout(new FormLayout());
int svnBranchLabelWidth = branchLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
int refreshButtonWidth = refreshProjectButton.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
formData = new FormData();
formData.bottom = new FormAttachment(100, 0);
formData.right = new FormAttachment(100, -1 * refreshButtonWidth - TAB_HORIZONTAL_PADDING_LEVEL_2);
formData.left = new FormAttachment(0, svnBranchLabelWidth + TAB_HORIZONTAL_PADDING_LEVEL_2);
Control svnBranchComboControl = branchesViewer.getControl();
svnBranchComboControl.setLayoutData(formData);
formData = new FormData();
formData.top = new FormAttachment(svnBranchComboControl, 0, SWT.CENTER);
formData.bottom = new FormAttachment(svnBranchComboControl, 0, SWT.CENTER);
formData.left = new FormAttachment(0, 0);
branchLabel.setLayoutData(formData);
formData = new FormData();
formData.right = new FormAttachment(100, 0);
if (EnvironmentUtils.isWindowsSystem()) {
formData.top = new FormAttachment(svnBranchComboControl, -1, SWT.TOP);
formData.bottom = new FormAttachment(svnBranchComboControl, 1, SWT.BOTTOM);
} else {
formData.top = new FormAttachment(svnBranchComboControl, 0, SWT.CENTER);
formData.bottom = new FormAttachment(svnBranchComboControl, 0, SWT.CENTER);
}
refreshProjectButton.setLayoutData(formData);
formData = new FormData();
formData.top = new FormAttachment(0, 0);
formData.left = new FormAttachment(0, 0);
formData.right = new FormAttachment(100, 0);
formData.bottom = new FormAttachment(branchArea, -1 * TAB_VERTICAL_PADDING_LEVEL_2, SWT.TOP);
projectViewer.getControl().setLayoutData(formData);
}
Aggregations