Skip to content
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

Rework PlainJava project type and Deprecate SettableValueProvider #9634

Merged
merged 30 commits into from
May 8, 2018
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
279a8f4
Adding pipeline
gazarenkov Feb 25, 2018
75110a8
Merge remote-tracking branch 'upstream/master'
Apr 4, 2018
303f689
del jenkinsfile
Apr 5, 2018
f9e5815
Merge remote-tracking branch 'upstream/master'
Apr 10, 2018
6fa7a55
Make exec agent not to use setsid for other than Linux envs
Apr 10, 2018
714aa1c
revert pom.xml
Apr 11, 2018
d778a01
goformat
Apr 11, 2018
95ee1cc
get projects folder from workkspace configuration
Apr 11, 2018
763848a
Merge remote-tracking branch 'upstream/master'
Apr 12, 2018
241390d
Merge remote-tracking branch 'upstream/master'
Apr 13, 2018
d625790
Merge with upstream
Apr 13, 2018
99abb5e
clean code
Apr 13, 2018
90b9167
clean code
Apr 13, 2018
127a79e
Fix calculation Projects Root so it wont cause NPE if there are no 'p…
gazarenkov Apr 16, 2018
2b5c11c
Revert "Fix calculation Projects Root so it wont cause NPE if there a…
gazarenkov Apr 16, 2018
f69fd75
Merge remote-tracking branch 'upstream/master'
gazarenkov Apr 16, 2018
1a407c0
Fix calculation Projects Root so it wont cause NPE if there are no 'p…
gazarenkov Apr 16, 2018
4fff97c
Merge remote-tracking branch 'upstream/master'
gazarenkov Apr 26, 2018
47faa53
replace provided attribute values with stored (src, out) in PlainJava…
gazarenkov Apr 26, 2018
e676928
Merge remote-tracking branch 'upstream/master'
gazarenkov Apr 29, 2018
82e4c17
fix PlainJavaProjectType for getting rid and deprecate using Settable…
gazarenkov Apr 29, 2018
3232ecc
remove comented code
May 3, 2018
65238e2
hide brouse source folder button, set source folder field as disabled
May 3, 2018
e6414e9
hide the browse source button, set source folder field to read only m…
May 4, 2018
d368a0d
adapt test for current changes on UI, set save button to enable state
May 4, 2018
7e56901
apply formatting
May 4, 2018
32f0767
fix order of steps in the test
May 7, 2018
9139278
resolve conflicts, merge with master
May 7, 2018
ad8f12d
resolve conflicts, merge with master
May 7, 2018
fa3b90a
Merge branch 'master' of https://github.com/gazarenkov/che
gazarenkov May 7, 2018
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 @@ -13,10 +13,10 @@
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import org.eclipse.che.api.core.model.workspace.Runtime;
import org.eclipse.che.api.core.model.workspace.Workspace;
import org.eclipse.che.api.core.model.workspace.WorkspaceConfig;
import org.eclipse.che.api.core.model.workspace.WorkspaceStatus;
import org.eclipse.che.api.workspace.shared.dto.RuntimeDto;
import org.eclipse.che.api.workspace.shared.dto.WorkspaceDto;
import org.eclipse.che.commons.annotation.Nullable;

Expand All @@ -32,48 +32,109 @@ public class WorkspaceImpl implements Workspace {
private RuntimeImpl runtime;
private Map<String, String> links;

public WorkspaceImpl(
String id,
String namespace,
WorkspaceConfig config,
RuntimeDto runtime,
Map<String, String> attributes,
boolean isTemporary,
WorkspaceStatus status,
Map<String, String> links) {
this.id = id;
this.namespace = namespace;
if (config != null) {
this.config = new WorkspaceConfigImpl(config);
}
if (runtime != null) {
this.runtime =
new RuntimeImpl(
runtime.getActiveEnv(),
runtime.getMachines(),
runtime.getOwner(),
runtime.getMachineToken(),
runtime.getWarnings());
}
if (attributes != null) {
this.attributes = new HashMap<>(attributes);
}
this.isTemporary = isTemporary;
this.status = status;
if (links != null) {
this.links = new HashMap<>(links);
}
// public WorkspaceImpl(
// String id,
// String namespace,
// WorkspaceConfig config,
// RuntimeDto runtime,
// Map<String, String> attributes,
// boolean isTemporary,
// WorkspaceStatus status,
// Map<String, String> links) {
// this.id = id;
// this.namespace = namespace;
// if (config != null) {
// this.config = new WorkspaceConfigImpl(config);
// }
// if (runtime != null) {
// this.runtime =
// new RuntimeImpl(
// runtime.getActiveEnv(),
// runtime.getMachines(),
// runtime.getOwner(),
// runtime.getMachineToken(),
// runtime.getWarnings());
// }
// if (attributes != null) {
// this.attributes = new HashMap<>(attributes);
// }
// this.isTemporary = isTemporary;
// this.status = status;
// if (links != null) {
// this.links = new HashMap<>(links);
// }
// }
//
// public WorkspaceImpl(
// String id,
// String namespace,
// WorkspaceConfig config,
// RuntimeImpl runtime,
// Map<String, String> attributes,
// boolean isTemporary,
// WorkspaceStatus status,
// Map<String, String> links) {
// this.id = id;
// this.namespace = namespace;
// if (config != null) {
// this.config = new WorkspaceConfigImpl(config);
// }
// if (runtime != null) {
// this.runtime =
// new RuntimeImpl(
// runtime.getActiveEnv(),
// runtime.getMachines(),
// runtime.getOwner(),
// runtime.getMachineToken(),
// runtime.getWarnings());
// }
// if (attributes != null) {
// this.attributes = new HashMap<>(attributes);
// }
// this.isTemporary = isTemporary;
// this.status = status;
// if (links != null) {
// this.links = new HashMap<>(links);
// }
// }

public WorkspaceImpl(WorkspaceImpl workspace) {
this(
workspace.getId(),
workspace.getNamespace(),
workspace.getConfig(),
workspace.getRuntime(),
workspace.getAttributes(),
workspace.isTemporary(),
workspace.getStatus(),
workspace.getLinks(),
workspace.getRuntime() != null ? workspace.getRuntime().getMachineToken() : null);
}

public WorkspaceImpl(WorkspaceDto workspace) {
this(
workspace.getId(),
workspace.getNamespace(),
workspace.getConfig(),
workspace.getRuntime(),
workspace.getAttributes(),
workspace.isTemporary(),
workspace.getStatus(),
workspace.getLinks(),
workspace.getRuntime() != null ? workspace.getRuntime().getMachineToken() : null);
}

public WorkspaceImpl(
private WorkspaceImpl(
String id,
String namespace,
WorkspaceConfig config,
RuntimeImpl runtime,
Runtime runtime,
Map<String, String> attributes,
boolean isTemporary,
WorkspaceStatus status,
Map<String, String> links) {
Map<String, String> links,
String machineToken) {

this.id = id;
this.namespace = namespace;
if (config != null) {
Expand All @@ -85,7 +146,7 @@ public WorkspaceImpl(
runtime.getActiveEnv(),
runtime.getMachines(),
runtime.getOwner(),
runtime.getMachineToken(),
machineToken,
runtime.getWarnings());
}
if (attributes != null) {
Expand All @@ -98,30 +159,6 @@ public WorkspaceImpl(
}
}

public WorkspaceImpl(WorkspaceImpl workspace) {
this(
workspace.getId(),
workspace.getNamespace(),
workspace.getConfig(),
workspace.getRuntime(),
workspace.getAttributes(),
workspace.isTemporary(),
workspace.getStatus(),
workspace.getLinks());
}

public WorkspaceImpl(WorkspaceDto workspace) {
this(
workspace.getId(),
workspace.getNamespace(),
workspace.getConfig(),
workspace.getRuntime(),
workspace.getAttributes(),
workspace.isTemporary(),
workspace.getStatus(),
workspace.getLinks());
}

@Override
public String getId() {
return id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
package org.eclipse.che.plugin.java.server.projecttype;

import static org.eclipse.che.ide.ext.java.shared.Constants.CONTAINS_JAVA_FILES;
import static org.eclipse.che.ide.ext.java.shared.Constants.OUTPUT_FOLDER;
import static org.eclipse.che.ide.ext.java.shared.Constants.SOURCE_FOLDER;

import com.google.inject.Inject;
import org.eclipse.che.api.project.server.type.ProjectTypeDef;
Expand All @@ -32,7 +30,7 @@ public JavaProjectType(JavaValueProviderFactory jpFactory) {
addConstantDefinition(Constants.LANGUAGE, "language", "java");
addVariableDefinition(Constants.LANGUAGE_VERSION, "java version", true, jpFactory);
addVariableDefinition(CONTAINS_JAVA_FILES, "contains java files", true, jpFactory);
addVariableDefinition(SOURCE_FOLDER, "java source folder", true, jpFactory);
addVariableDefinition(OUTPUT_FOLDER, "java output folder", false, jpFactory);
// addVariableDefinition(SOURCE_FOLDER, "java source folder", true, jpFactory);
// addVariableDefinition(OUTPUT_FOLDER, "java output folder", false, jpFactory);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ public void go(AcceptsOneWidget container) {
}

updateView();
validateCoordinates();
}

@Override
Expand All @@ -94,7 +93,6 @@ public void onCoordinatesChanged() {
setAttribute(
LIBRARY_FOLDER, Arrays.asList(view.getLibraryFolder().split(ATTRIBUTE_VALUE_SEPARATOR)));

validateCoordinates();
updateDelegate.updateControls();
}

Expand Down Expand Up @@ -145,7 +143,7 @@ private void setAttribute(String attrId, List<String> value) {
}

private boolean isCoordinatesCompleted() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method looks redundant since there's just one place where isCoordinatesCompleted() is called.

return !getAttribute(SOURCE_FOLDER).isEmpty();
return true;
}

private void updateView() {
Expand Down Expand Up @@ -175,8 +173,4 @@ private String convertAttributeValuesToString(List<String> values) {
? result.toString()
: result.delete(result.lastIndexOf(ATTRIBUTE_VALUE_SEPARATOR), result.length()).toString();
}

private void validateCoordinates() {
view.showSourceFolderMissingIndicator(view.getSourceFolder().isEmpty());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,6 @@ interface PlainJavaPageView extends View<PlainJavaPageView.ActionDelegate> {
/** Sets value of the library folder attribute. */
void setLibraryFolder(String value);

/**
* Marks a field with information about source folder as empty.
*
* @param doShow <code>true</code> to show wrong border, <code>false</code> to hide it
*/
void showSourceFolderMissingIndicator(boolean doShow);

/**
* Sets whether Browse button is visible.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyUpEvent;
import com.google.gwt.resources.client.CssResource;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
Expand All @@ -35,7 +34,6 @@ public class PlainJavaPageViewImpl implements PlainJavaPageView {

private final FlowPanel rootElement;

@UiField Style style;
@UiField TextBox sourceFolderField;
@UiField Button browseSourceBtn;
@UiField TextBox libFolderField;
Expand All @@ -47,14 +45,8 @@ public class PlainJavaPageViewImpl implements PlainJavaPageView {
@Inject
public PlainJavaPageViewImpl() {
rootElement = ourUiBinder.createAndBindUi(this);

browseSourceBtn.addClickHandler(
new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
delegate.onBrowseSourceButtonClicked();
}
});
browseSourceBtn.setVisible(false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

browseSourceBtn is always hidden so I guess it's not needed anymore. Should it be removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree but lets do it later )

sourceFolderField.setReadOnly(true);

browseLibBtn.addClickHandler(
new ClickHandler() {
Expand Down Expand Up @@ -100,18 +92,9 @@ void onKeyUp(KeyUpEvent event) {
delegate.onCoordinatesChanged();
}

@Override
public void showSourceFolderMissingIndicator(boolean doShow) {
if (doShow) {
sourceFolderField.addStyleName(style.inputError());
} else {
sourceFolderField.removeStyleName(style.inputError());
}
}

@Override
public void changeBrowseBtnVisibleState(boolean isVisible) {
browseSourceBtn.setVisible(isVisible);
browseSourceBtn.setVisible(false);
}

@Override
Expand All @@ -121,12 +104,8 @@ public void changeLibraryPanelVisibleState(boolean isVisible) {

@Override
public void changeSourceFolderFieldState(boolean isEnable) {
sourceFolderField.setEnabled(isEnable);
sourceFolderField.setReadOnly(true);
}

interface PlainJavaPageViewImplUiBinder extends UiBinder<FlowPanel, PlainJavaPageViewImpl> {}

interface Style extends CssResource {
String inputError();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
xmlns:g='urn:import:com.google.gwt.user.client.ui'>
<ui:with field='locale' type='org.eclipse.che.plugin.java.plain.client.PlainJavaLocalizationConstant'/>

<ui:style src="org/eclipse/che/ide/api/ui/style.css"
type="org.eclipse.che.plugin.java.plain.client.wizard.PlainJavaPageViewImpl.Style">
<ui:style src="org/eclipse/che/ide/api/ui/style.css">

.field {
color: #dbdbdb;
Expand Down Expand Up @@ -46,11 +45,6 @@
display: none;
}

.inputError {
border-color: #ffe400;
box-shadow: 0 0 5px #ffe400;
}

.tooltip:hover > span {
display: inline;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ public PlainJavaProjectType(
MediaTypesExcludeMatcher mediaTypesExcludeMatcher) {
super(JAVAC, JAVAC_PROJECT_NAME, true, false, true);

setValueProviderFactory(SOURCE_FOLDER, valueProviderFactory);
setValueProviderFactory(OUTPUT_FOLDER, valueProviderFactory);
// setValueProviderFactory(SOURCE_FOLDER, valueProviderFactory);
// setValueProviderFactory(OUTPUT_FOLDER, valueProviderFactory);
// addVariableDefinition(SOURCE_FOLDER, "java src folder", true);
// addVariableDefinition(OUTPUT_FOLDER, "java output folder", true);
addVariableDefinition(SOURCE_FOLDER, "java src folder", true, valueProviderFactory);
addVariableDefinition(OUTPUT_FOLDER, "java output folder", true, valueProviderFactory);

addVariableDefinition(LIBRARY_FOLDER, "java library folder", false);

Expand Down
Loading