Skip to content

fix #5138 #5139

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,10 @@
import org.apache.hop.ui.hopgui.HopGui;
import org.apache.hop.ui.pipeline.transform.BaseTransformDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Event;
Expand Down Expand Up @@ -146,103 +143,84 @@ public String open() {
Button wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
wCancel.addListener(SWT.Selection, event -> cancel());
BaseTransformDialog.positionBottomButtons(shell, new Button[] {wOk, wCancel}, margin * 3, null);

ScrolledComposite scroll = new ScrolledComposite(shell, SWT.V_SCROLL);
scroll.setLayout(new FillLayout());
scroll.setExpandHorizontal(true);
scroll.setExpandVertical(true);
scroll.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_BLACK));
PropsUi.setLook(scroll);
shell.setLayoutData(scroll);

FormData fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(0, 0);
fd.bottom = new FormAttachment(wOk, 0);
scroll.setLayoutData(fd);

Composite comp = new Composite(scroll, SWT.NONE);
comp.setLayout(new FormLayout());
PropsUi.setLook(comp);

Label wlName = new Label(comp, SWT.RIGHT);
BaseTransformDialog.positionBottomButtons(shell, new Button[] {wOk, wCancel}, margin, null);

Label wlName = new Label(shell, SWT.RIGHT);
PropsUi.setLook(wlName);
wlName.setText(BaseMessages.getString(PKG, "ProjectDialog.Label.ProjectName"));
FormData fdlName = new FormData();
fdlName.left = new FormAttachment(0, 0);
fdlName.right = new FormAttachment(middle, 0);
fdlName.right = new FormAttachment(middle, -margin);
fdlName.top = new FormAttachment(0, margin);
wlName.setLayoutData(fdlName);
wName = new Text(comp, SWT.SINGLE | SWT.BORDER | SWT.LEFT);
wName = new Text(shell, SWT.SINGLE | SWT.BORDER | SWT.LEFT);
PropsUi.setLook(wName);
FormData fdName = new FormData();
fdName.left = new FormAttachment(middle, margin);
fdName.right = new FormAttachment(98, 0);
fdName.top = new FormAttachment(wlName, 0, SWT.CENTER);
fdName.left = new FormAttachment(middle, 0);
fdName.right = new FormAttachment(100, -margin);
fdName.top = new FormAttachment(0, margin);
wName.setLayoutData(fdName);
Control lastControl = wName;

Label wlHome = new Label(comp, SWT.RIGHT);
Label wlHome = new Label(shell, SWT.RIGHT);
PropsUi.setLook(wlHome);
wlHome.setText(BaseMessages.getString(PKG, "ProjectDialog.Label.HomeFolder"));
FormData fdlHome = new FormData();
fdlHome.left = new FormAttachment(0, 0);
fdlHome.right = new FormAttachment(middle, 0);
fdlHome.right = new FormAttachment(middle, -margin);
fdlHome.top = new FormAttachment(lastControl, margin);
wlHome.setLayoutData(fdlHome);
Button wbHome = new Button(comp, SWT.PUSH);
Button wbHome = new Button(shell, SWT.PUSH);
PropsUi.setLook(wbHome);
wbHome.setText(BaseMessages.getString(PKG, "ProjectDialog.Button.Browse"));
FormData fdbHome = new FormData();
fdbHome.right = new FormAttachment(98, 0);
fdbHome.top = new FormAttachment(wlHome, 0, SWT.CENTER);
fdbHome.right = new FormAttachment(100, -margin);
fdbHome.top = new FormAttachment(lastControl, margin);
wbHome.setLayoutData(fdbHome);
wbHome.addListener(SWT.Selection, this::browseHomeFolder);
wHome = new TextVar(variables, comp, SWT.SINGLE | SWT.BORDER | SWT.LEFT);
wHome = new TextVar(variables, shell, SWT.SINGLE | SWT.BORDER | SWT.LEFT);
PropsUi.setLook(wHome);
FormData fdHome = new FormData();
fdHome.left = new FormAttachment(middle, margin);
fdHome.left = new FormAttachment(middle, 0);
fdHome.right = new FormAttachment(wbHome, -margin);
fdHome.top = new FormAttachment(wlHome, 0, SWT.CENTER);
fdHome.top = new FormAttachment(lastControl, margin);
wHome.setLayoutData(fdHome);
lastControl = wHome;

Label wlConfigFile = new Label(comp, SWT.RIGHT);
Label wlConfigFile = new Label(shell, SWT.RIGHT);
PropsUi.setLook(wlConfigFile);
wlConfigFile.setText(BaseMessages.getString(PKG, "ProjectDialog.Label.ConfigurationFile"));
FormData fdlConfigFile = new FormData();
fdlConfigFile.left = new FormAttachment(0, 0);
fdlConfigFile.right = new FormAttachment(middle, 0);
fdlConfigFile.right = new FormAttachment(middle, -margin);
fdlConfigFile.top = new FormAttachment(lastControl, margin);
wlConfigFile.setLayoutData(fdlConfigFile);
Button wbConfigFile = new Button(comp, SWT.PUSH);
Button wbConfigFile = new Button(shell, SWT.PUSH);
PropsUi.setLook(wbConfigFile);
wbConfigFile.setText(BaseMessages.getString(PKG, "ProjectDialog.Button.Browse"));
FormData fdbConfigFile = new FormData();
fdbConfigFile.right = new FormAttachment(98, 0);
fdbConfigFile.top = new FormAttachment(wlConfigFile, 0, SWT.CENTER);
fdbConfigFile.right = new FormAttachment(100, -margin);
fdbConfigFile.top = new FormAttachment(lastControl, margin);
wbConfigFile.setLayoutData(fdbConfigFile);
wbConfigFile.addListener(SWT.Selection, this::browseConfigFolder);
wConfigFile = new TextVar(variables, comp, SWT.SINGLE | SWT.BORDER | SWT.LEFT);
wConfigFile = new TextVar(variables, shell, SWT.SINGLE | SWT.BORDER | SWT.LEFT);
PropsUi.setLook(wConfigFile);
FormData fdConfigFile = new FormData();
fdConfigFile.left = new FormAttachment(middle, margin);
fdConfigFile.left = new FormAttachment(middle, 0);
fdConfigFile.right = new FormAttachment(wbConfigFile, -margin);
fdConfigFile.top = new FormAttachment(wlConfigFile, 0, SWT.CENTER);
fdConfigFile.top = new FormAttachment(lastControl, margin);
wConfigFile.setLayoutData(fdConfigFile);
lastControl = wConfigFile;

Label wlParentProject = new Label(comp, SWT.RIGHT);
Label wlParentProject = new Label(shell, SWT.RIGHT);
PropsUi.setLook(wlParentProject);
wlParentProject.setText(BaseMessages.getString(PKG, "ProjectDialog.Label.ParentProject"));
FormData fdlParentProject = new FormData();
fdlParentProject.left = new FormAttachment(0, 0);
fdlParentProject.right = new FormAttachment(middle, 0);
fdlParentProject.top = new FormAttachment(lastControl, margin);
wlParentProject.setLayoutData(fdlParentProject);
wParentProject = new ComboVar(variables, comp, SWT.SINGLE | SWT.BORDER | SWT.LEFT);
wParentProject = new ComboVar(variables, shell, SWT.SINGLE | SWT.BORDER | SWT.LEFT);
PropsUi.setLook(wParentProject);
FormData fdParentProject = new FormData();
fdParentProject.left = new FormAttachment(middle, margin);
Expand All @@ -251,140 +229,141 @@ public String open() {
wParentProject.setLayoutData(fdParentProject);
lastControl = wParentProject;

Label wlDescription = new Label(comp, SWT.RIGHT);
Label wlDescription = new Label(shell, SWT.RIGHT);
PropsUi.setLook(wlDescription);
wlDescription.setText(BaseMessages.getString(PKG, "ProjectDialog.Label.Description"));
FormData fdlDescription = new FormData();
fdlDescription.left = new FormAttachment(0, 0);
fdlDescription.right = new FormAttachment(middle, 0);
fdlDescription.right = new FormAttachment(middle, -margin);
fdlDescription.top = new FormAttachment(lastControl, margin);
wlDescription.setLayoutData(fdlDescription);
wDescription = new Text(comp, SWT.SINGLE | SWT.BORDER | SWT.LEFT);
wDescription = new Text(shell, SWT.SINGLE | SWT.BORDER | SWT.LEFT);
PropsUi.setLook(wDescription);
FormData fdDescription = new FormData();
fdDescription.left = new FormAttachment(middle, margin);
fdDescription.right = new FormAttachment(98, 0);
fdDescription.top = new FormAttachment(wlDescription, 0, SWT.CENTER);
fdDescription.left = new FormAttachment(middle, 0);
fdDescription.right = new FormAttachment(100, -margin);
fdDescription.top = new FormAttachment(lastControl, margin);
wDescription.setLayoutData(fdDescription);
lastControl = wDescription;

Label wlCompany = new Label(comp, SWT.RIGHT);
Label wlCompany = new Label(shell, SWT.RIGHT);
PropsUi.setLook(wlCompany);
wlCompany.setText(BaseMessages.getString(PKG, "ProjectDialog.Label.Company"));
FormData fdlCompany = new FormData();
fdlCompany.left = new FormAttachment(0, 0);
fdlCompany.right = new FormAttachment(middle, 0);
fdlCompany.right = new FormAttachment(middle, -margin);
fdlCompany.top = new FormAttachment(lastControl, margin);
wlCompany.setLayoutData(fdlCompany);
wCompany = new Text(comp, SWT.SINGLE | SWT.BORDER | SWT.LEFT);
wCompany = new Text(shell, SWT.SINGLE | SWT.BORDER | SWT.LEFT);
PropsUi.setLook(wCompany);
FormData fdCompany = new FormData();
fdCompany.left = new FormAttachment(middle, margin);
fdCompany.right = new FormAttachment(98, 0);
fdCompany.top = new FormAttachment(wlCompany, 0, SWT.CENTER);
fdCompany.left = new FormAttachment(middle, 0);
fdCompany.right = new FormAttachment(100, -margin);
fdCompany.top = new FormAttachment(lastControl, margin);
wCompany.setLayoutData(fdCompany);
lastControl = wCompany;

Label wlDepartment = new Label(comp, SWT.RIGHT);
Label wlDepartment = new Label(shell, SWT.RIGHT);
PropsUi.setLook(wlDepartment);
wlDepartment.setText(BaseMessages.getString(PKG, "ProjectDialog.Label.Department"));
FormData fdlDepartment = new FormData();
fdlDepartment.left = new FormAttachment(0, 0);
fdlDepartment.right = new FormAttachment(middle, 0);
fdlDepartment.right = new FormAttachment(middle, -margin);
fdlDepartment.top = new FormAttachment(lastControl, margin);
wlDepartment.setLayoutData(fdlDepartment);
wDepartment = new Text(comp, SWT.SINGLE | SWT.BORDER | SWT.LEFT);
wDepartment = new Text(shell, SWT.SINGLE | SWT.BORDER | SWT.LEFT);
PropsUi.setLook(wDepartment);
FormData fdDepartment = new FormData();
fdDepartment.left = new FormAttachment(middle, margin);
fdDepartment.right = new FormAttachment(98, 0);
fdDepartment.top = new FormAttachment(wlDepartment, 0, SWT.CENTER);
fdDepartment.left = new FormAttachment(middle, 0);
fdDepartment.right = new FormAttachment(100, -margin);
fdDepartment.top = new FormAttachment(lastControl, margin);
wDepartment.setLayoutData(fdDepartment);
lastControl = wDepartment;

Label wlMetadataBaseFolder = new Label(comp, SWT.RIGHT);
Label wlMetadataBaseFolder = new Label(shell, SWT.RIGHT);
PropsUi.setLook(wlMetadataBaseFolder);
wlMetadataBaseFolder.setText(
BaseMessages.getString(PKG, "ProjectDialog.Label.MetadataBaseFolder"));
FormData fdlMetadataBaseFolder = new FormData();
fdlMetadataBaseFolder.left = new FormAttachment(0, 0);
fdlMetadataBaseFolder.right = new FormAttachment(middle, 0);
fdlMetadataBaseFolder.right = new FormAttachment(middle, -margin);
fdlMetadataBaseFolder.top = new FormAttachment(lastControl, margin);
wlMetadataBaseFolder.setLayoutData(fdlMetadataBaseFolder);
wMetadataBaseFolder = new TextVar(variables, comp, SWT.SINGLE | SWT.BORDER | SWT.LEFT);
wMetadataBaseFolder = new TextVar(variables, shell, SWT.SINGLE | SWT.BORDER | SWT.LEFT);
PropsUi.setLook(wMetadataBaseFolder);
FormData fdMetadataBaseFolder = new FormData();
fdMetadataBaseFolder.left = new FormAttachment(middle, margin);
fdMetadataBaseFolder.right = new FormAttachment(98, 0);
fdMetadataBaseFolder.top = new FormAttachment(wlMetadataBaseFolder, 0, SWT.CENTER);
fdMetadataBaseFolder.left = new FormAttachment(middle, 0);
fdMetadataBaseFolder.right = new FormAttachment(100, -margin);
fdMetadataBaseFolder.top = new FormAttachment(lastControl, margin);
wMetadataBaseFolder.setLayoutData(fdMetadataBaseFolder);
wMetadataBaseFolder.addModifyListener(e -> updateIVariables());
lastControl = wMetadataBaseFolder;

Label wlUnitTestsBasePath = new Label(comp, SWT.RIGHT);
Label wlUnitTestsBasePath = new Label(shell, SWT.RIGHT);
PropsUi.setLook(wlUnitTestsBasePath);
wlUnitTestsBasePath.setText(
BaseMessages.getString(PKG, "ProjectDialog.Label.UnitTestBaseFolder"));
FormData fdlUnitTestsBasePath = new FormData();
fdlUnitTestsBasePath.left = new FormAttachment(0, 0);
fdlUnitTestsBasePath.right = new FormAttachment(middle, 0);
fdlUnitTestsBasePath.right = new FormAttachment(middle, -margin);
fdlUnitTestsBasePath.top = new FormAttachment(lastControl, margin);
wlUnitTestsBasePath.setLayoutData(fdlUnitTestsBasePath);
wUnitTestsBasePath = new TextVar(variables, comp, SWT.SINGLE | SWT.BORDER | SWT.LEFT);
wUnitTestsBasePath = new TextVar(variables, shell, SWT.SINGLE | SWT.BORDER | SWT.LEFT);
PropsUi.setLook(wUnitTestsBasePath);
FormData fdUnitTestsBasePath = new FormData();
fdUnitTestsBasePath.left = new FormAttachment(middle, margin);
fdUnitTestsBasePath.right = new FormAttachment(98, 0);
fdUnitTestsBasePath.top = new FormAttachment(wlUnitTestsBasePath, 0, SWT.CENTER);
fdUnitTestsBasePath.left = new FormAttachment(middle, 0);
fdUnitTestsBasePath.right = new FormAttachment(100, -margin);
fdUnitTestsBasePath.top = new FormAttachment(lastControl, margin);
wUnitTestsBasePath.setLayoutData(fdUnitTestsBasePath);
wUnitTestsBasePath.addModifyListener(e -> updateIVariables());
lastControl = wUnitTestsBasePath;

Label wlDataSetCsvFolder = new Label(comp, SWT.RIGHT);
Label wlDataSetCsvFolder = new Label(shell, SWT.RIGHT);
PropsUi.setLook(wlDataSetCsvFolder);
wlDataSetCsvFolder.setText(BaseMessages.getString(PKG, "ProjectDialog.Label.DatasetCSVFolder"));
FormData fdlDataSetCsvFolder = new FormData();
fdlDataSetCsvFolder.left = new FormAttachment(0, 0);
fdlDataSetCsvFolder.right = new FormAttachment(middle, 0);
fdlDataSetCsvFolder.right = new FormAttachment(middle, -margin);
fdlDataSetCsvFolder.top = new FormAttachment(lastControl, margin);
wlDataSetCsvFolder.setLayoutData(fdlDataSetCsvFolder);
wDataSetCsvFolder = new TextVar(variables, comp, SWT.SINGLE | SWT.BORDER | SWT.LEFT);
wDataSetCsvFolder = new TextVar(variables, shell, SWT.SINGLE | SWT.BORDER | SWT.LEFT);
PropsUi.setLook(wDataSetCsvFolder);
FormData fdDataSetCsvFolder = new FormData();
fdDataSetCsvFolder.left = new FormAttachment(middle, margin);
fdDataSetCsvFolder.right = new FormAttachment(98, 0);
fdDataSetCsvFolder.top = new FormAttachment(wlDataSetCsvFolder, 0, SWT.CENTER);
fdDataSetCsvFolder.left = new FormAttachment(middle, 0);
fdDataSetCsvFolder.right = new FormAttachment(100, -margin);
fdDataSetCsvFolder.top = new FormAttachment(lastControl, margin);
wDataSetCsvFolder.setLayoutData(fdDataSetCsvFolder);
wDataSetCsvFolder.addModifyListener(e -> updateIVariables());
lastControl = wDataSetCsvFolder;

Label wlEnforceHomeExecution = new Label(comp, SWT.RIGHT);
Label wlEnforceHomeExecution = new Label(shell, SWT.RIGHT);
PropsUi.setLook(wlEnforceHomeExecution);
wlEnforceHomeExecution.setText(
BaseMessages.getString(PKG, "ProjectDialog.Label.EnforceExecutionInHome"));
FormData fdlEnforceHomeExecution = new FormData();
fdlEnforceHomeExecution.left = new FormAttachment(0, 0);
fdlEnforceHomeExecution.right = new FormAttachment(middle, 0);
fdlEnforceHomeExecution.right = new FormAttachment(middle, -margin);
fdlEnforceHomeExecution.top = new FormAttachment(lastControl, margin);
wlEnforceHomeExecution.setLayoutData(fdlEnforceHomeExecution);
wEnforceHomeExecution = new Button(comp, SWT.CHECK | SWT.LEFT);
wEnforceHomeExecution = new Button(shell, SWT.CHECK | SWT.LEFT);
PropsUi.setLook(wEnforceHomeExecution);
FormData fdEnforceHomeExecution = new FormData();
fdEnforceHomeExecution.left = new FormAttachment(middle, margin);
fdEnforceHomeExecution.right = new FormAttachment(98, 0);
fdEnforceHomeExecution.top = new FormAttachment(wlEnforceHomeExecution, 0, SWT.CENTER);
fdEnforceHomeExecution.left = new FormAttachment(middle, 0);
fdEnforceHomeExecution.right = new FormAttachment(100, -margin);
fdEnforceHomeExecution.top = new FormAttachment(lastControl, margin);
wEnforceHomeExecution.setLayoutData(fdEnforceHomeExecution);
lastControl = wlEnforceHomeExecution;

Label wlVariables = new Label(comp, SWT.LEFT);
Label wlVariables = new Label(shell, SWT.LEFT);
PropsUi.setLook(wlVariables);
wlVariables.setText(
BaseMessages.getString(PKG, "ProjectDialog.Group.Label.ProjectVariablesToSet"));
FormData fdlVariables = new FormData();
fdlVariables.left = new FormAttachment(0, 0);
fdlVariables.right = new FormAttachment(98, 0);
fdlVariables.left = new FormAttachment(0, margin);
fdlVariables.right = new FormAttachment(100, 0);
fdlVariables.top = new FormAttachment(lastControl, 2 * margin);
wlVariables.setLayoutData(fdlVariables);
lastControl = wlVariables;

ColumnInfo[] columnInfo =
new ColumnInfo[] {
Expand All @@ -410,18 +389,18 @@ public String open() {
wVariables =
new TableView(
new Variables(),
comp,
SWT.BORDER,
shell,
SWT.BORDER | SWT.H_SCROLL,
columnInfo,
Math.max(project.getDescribedVariables().size(), 3),
null,
props);
PropsUi.setLook(wVariables);
FormData fdVariables = new FormData();
fdVariables.left = new FormAttachment(0, 0);
fdVariables.right = new FormAttachment(98, 0);
fdVariables.top = new FormAttachment(wlVariables, margin);
fdVariables.bottom = new FormAttachment(100, -margin * 2);
fdVariables.left = new FormAttachment(0, margin);
fdVariables.right = new FormAttachment(100, -margin);
fdVariables.top = new FormAttachment(lastControl, margin);
fdVariables.bottom = new FormAttachment(100, -margin * 5);
wVariables.setLayoutData(fdVariables);
wVariables.addModifyListener(e -> needingProjectRefresh = true);

Expand All @@ -431,11 +410,6 @@ public String open() {
wHome.addModifyListener(e -> needingProjectRefresh = true);

getData();

comp.pack();
scroll.setContent(comp);
scroll.setMinSize(comp.computeSize(SWT.DEFAULT, SWT.DEFAULT));
shell.setMinimumSize(comp.getBounds().width, 200);
shell.setDefaultButton(wOk);
BaseDialog.defaultShellHandling(shell, c -> ok(), c -> cancel());

Expand Down