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

Refactored Window class #8374

Merged
merged 41 commits into from
Feb 12, 2018
Merged
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
38a0df8
Refactored Window class
vzhukovs Jan 19, 2018
332e0d1
Fix formatting issue
vzhukovs Jan 19, 2018
6617ba5
Merge branch 'master' into che#7200
vzhukovs Jan 19, 2018
2c10c89
Merge branch 'master' into che#7200
vzhukovs Jan 22, 2018
627abfb
Fix errors
vzhukovs Jan 22, 2018
4d9b7d7
Code improvements
vzhukovs Jan 22, 2018
469304b
Rename variable
vzhukovs Jan 22, 2018
e66ebac
Fixes
vzhukovs Jan 23, 2018
1925e6e
Fix formatting issue
vzhukovs Jan 23, 2018
9c7610b
Fix formatting issue
vzhukovs Jan 23, 2018
d78f1ee
Minor fixes
vzhukovs Jan 23, 2018
61aab62
Minor fixes
vzhukovs Jan 23, 2018
7302ca6
Merge branch 'master' into che#7200
vzhukovs Jan 23, 2018
942cb3a
Minor fixes
vzhukovs Jan 23, 2018
43afc49
Fix npe
vzhukovs Jan 24, 2018
f6e96ff
Update locators
vzhukovs Jan 25, 2018
032d6ed
Merge branch 'master' into che#7200
vzhukovs Jan 26, 2018
0c58aa0
Minor fixes
vzhukovs Jan 26, 2018
da236de
Minor fixes
vzhukovs Jan 28, 2018
8b0d713
Merge branch 'master' into che#7200
vzhukovs Jan 30, 2018
561a915
Resolve conflicts
vzhukovs Jan 30, 2018
a5ea26b
Minor fixes
vzhukovs Jan 30, 2018
2a6924e
Minor fixes
vzhukovs Jan 31, 2018
b0fe4a9
Minor fixes
vzhukovs Jan 31, 2018
565f1f2
Minor fixes
vzhukovs Jan 31, 2018
52743c0
Merge branch 'master' into che#7200
vzhukovs Feb 1, 2018
6da30f9
Adopting the code after merge
vzhukovs Feb 1, 2018
1a91877
Merge branch 'master' into che#7200
vzhukovs Feb 5, 2018
801587f
Minor fixes
vzhukovs Feb 6, 2018
bb2f0e7
Minor fixes
vzhukovs Feb 6, 2018
7621a4a
Minor fixes
vzhukovs Feb 6, 2018
e24e090
Minor fixes
vzhukovs Feb 7, 2018
597fc02
Merge branch 'master' into che#7200
vzhukovs Feb 7, 2018
85ce488
Fix test
vzhukovs Feb 7, 2018
2d2bd43
Fix formatting
vzhukovs Feb 7, 2018
e9ad9d4
Remove commented code
vzhukovs Feb 7, 2018
6341437
Used corrected method
vzhukovs Feb 7, 2018
e9a46b9
Use single import instead of wildcard
vzhukovs Feb 7, 2018
2b27bf7
New line
vzhukovs Feb 7, 2018
4382e0d
Code refinment
vzhukovs Feb 12, 2018
2b23c0a
Fix wildcard imports
vzhukovs Feb 12, 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 @@ -28,7 +28,6 @@
import org.eclipse.che.ide.ui.list.SimpleList;
import org.eclipse.che.ide.ui.smartTree.TreeStyles;
import org.eclipse.che.ide.ui.tree.Tree;
import org.eclipse.che.ide.ui.window.Window;
import org.eclipse.che.ide.ui.zeroclipboard.ClipboardResources;
import org.vectomatic.dom.svg.ui.SVGResource;

Expand All @@ -38,8 +37,7 @@
* @author Codenvy crowd
*/
public interface Resources
extends Window.Resources,
Tree.Resources,
extends Tree.Resources,
PartStackUIResources,
SimpleList.Resources,
MenuResources,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;
import org.eclipse.che.ide.command.CommandResources;
import org.eclipse.che.ide.ui.window.Window;

/**
* Implementation of {@link CommandEditorView}.
Expand All @@ -36,7 +35,6 @@ public class CommandEditorViewImpl extends Composite implements CommandEditorVie

private static final CommandEditorViewImplUiBinder UI_BINDER =
GWT.create(CommandEditorViewImplUiBinder.class);
private static final Window.Resources WINDOW_RESOURCES = GWT.create(Window.Resources.class);

private final CommandResources resources;

Expand All @@ -57,7 +55,6 @@ public CommandEditorViewImpl(CommandResources resources) {

initWidget(UI_BINDER.createAndBindUi(this));
setSaveEnabled(false);
saveButton.addStyleName(WINDOW_RESOURCES.windowCss().primaryButton());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public CommandsPalettePresenter(
}

public void showDialog() {
view.show();
view.showDialog();
view.setCommands(commandUtils.groupCommandsByGoal(commandManager.getCommands()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
public interface CommandsPaletteView extends View<CommandsPaletteView.ActionDelegate> {

/** Show the view. */
void show();
void showDialog();

/** Close the view. */
void close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ public CommandsPaletteViewImpl(NodeFactory nodeFactory, PaletteMessages messages

filterField.getElement().setAttribute("placeholder", messages.filterPlaceholder());
initHintLabel();
getFooter().removeFromParent();
}

private void initHintLabel() {
Expand Down Expand Up @@ -116,11 +115,13 @@ private SpanElement createKeyLabel() {
}

@Override
public void show() {
super.show();
public void showDialog() {
show(filterField);
}

@Override
protected void onShow() {
filterField.setValue("");
filterField.setFocus(true);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,23 +70,21 @@ protected CreateFactoryViewImpl(
ClipboardButtonBuilder buttonBuilder) {
this.factoryResources = factoryResources;
setTitle(locale.createFactoryTitle());
setWidget(uiBinder.createAndBindUi(this));
Widget widget = uiBinder.createAndBindUi(this);
widget.getElement().getStyle().setPadding(0, Unit.PX);
setWidget(widget);
factoryNameLabel.setText(locale.createFactoryName());
factoryLinkLabel.setText(locale.createFactoryLink());
configure.getElement().insertFirst(factoryResources.configure().getSvg().getElement());
launch.getElement().insertFirst(factoryResources.execute().getSvg().getElement());
launch.addStyleName(style.launchIcon());
configure.addStyleName(style.configureIcon());
createFactoryButton.setEnabled(false);
Button cancelButton =
createButton(
locale.createFactoryButtonClose(),
"git-remotes-pull-cancel",
event -> delegate.onCancelClicked());
addFooterButton(
locale.createFactoryButtonClose(),
"projectReadOnlyGitUrl-btnClose",
event -> delegate.onCancelClicked());
createFactoryButton.addClickHandler(clickEvent -> delegate.onCreateClicked());
cancelButton.ensureDebugId("projectReadOnlyGitUrl-btnClose");
addButtonToFooter(cancelButton);
getWidget().getElement().getStyle().setPadding(0, Unit.PX);
buttonBuilder.withResourceWidget(factoryLink).build();
factoryLink.setReadOnly(true);
final Tooltip launchFactoryTooltip =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ public void showDialog() {
/** {@inheritDoc} */
@Override
public void onCancelClicked() {
view.onClose();
view.closeDialog();
}

/** {@inheritDoc} */
@Override
public void onImportClicked() {
view.onClose();
view.closeDialog();

FactoryDto factoryDTO;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ interface ActionDelegate {
void showDialog();

/** Close dialog */
void onClose();
void closeDialog();

/** Sets the delegate to receive events from this view. */
void setDelegate(ActionDelegate delegate);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public interface ImportFromConfigViewBinder extends UiBinder<Widget, ImportFromC

@UiField FormPanel uploadForm;
@UiField Label errorMessage;
FileUpload fileUpload;
private FileUpload fileUpload;

private ActionDelegate delegate;

Expand All @@ -50,31 +50,18 @@ public ImportFromConfigViewImpl(
this.setTitle(locale.importFromConfigurationTitle());
setWidget(importFromConfigViewBinder.createAndBindUi(this));

addFooterButton(
locale.cancelButton(),
"import-from-config-btn-cancel",
event -> delegate.onCancelClicked());

buttonImport =
createButton(
addFooterButton(
locale.importButton(),
"import-from-config-btn-import",
event -> delegate.onImportClicked());
buttonImport.addStyleName(resources.windowCss().primaryButton());
buttonImport.addStyleName(resources.windowCss().buttonAlignRight());
addButtonToFooter(buttonImport);

Button buttonCancel =
createButton(
locale.cancelButton(),
"import-from-config-btn-cancel",
event -> delegate.onCancelClicked());
buttonCancel.addStyleName(resources.windowCss().buttonAlignRight());
addButtonToFooter(buttonCancel);
}
event -> delegate.onImportClicked(),
true);

/** {@inheritDoc} */
@Override
public void showDialog() {
uploadForm.clear();

errorMessage.setText("");
fileContent = null;
fileUpload = new FileUpload();
fileUpload.setHeight("22px");
fileUpload.setWidth("100%");
Expand All @@ -85,17 +72,21 @@ public void showDialog() {
fileUpload.addChangeHandler(event -> buttonImport.setEnabled(fileUpload.getFilename() != null));

uploadForm.add(fileUpload);
}

/** {@inheritDoc} */
@Override
public void showDialog() {
errorMessage.setText("");
fileContent = null;

this.show();
}

/** {@inheritDoc} */
@Override
public void onClose() {
public void closeDialog() {
hide();

uploadForm.remove(fileUpload);
fileUpload = null;
}

/** {@inheritDoc} */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public void showHotKeys(String scheme) {
view.setData(categories);
view.setSchemes(selectedSchemeId, keyBindingAgent.getSchemes());
view.renderKeybindings();
view.show();
view.showDialog();
}

private List<HotKeyItem> getIDEHotKey() {
Expand Down Expand Up @@ -136,12 +136,12 @@ private List<HotKeyItem> getEditorHotKey() {
@Override
public void onSaveClicked() {
keyBindingAgent.setActive(selectedSchemeId);
view.hide();
view.hideDialog();
}

@Override
public void onCloseClicked() {
view.hide();
view.hideDialog();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
public interface HotKeysDialogView extends View<HotKeysDialogView.ActionDelegate> {

/** Reset filter input and Show dialog. */
void show();
void showDialog();

/** Clear and Render keybinding combination. */
void renderKeybindings();

/** Hide dialog. */
void hide();
void hideDialog();

/**
* Set keybindings map for displaying.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.SpanElement;
import com.google.gwt.dom.client.Style;
import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ChangeHandler;
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.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
Expand Down Expand Up @@ -57,11 +53,7 @@ interface KeyMapViewImplUiBinder extends UiBinder<Widget, HotKeysDialogViewImpl>
private final HotKeyResources hotKeyResources;

private final Category.CategoryEventDelegate<HotKeyItem> keyBindingsEventDelegate =
new Category.CategoryEventDelegate<HotKeyItem>() {

@Override
public void onListItemClicked(Element listItemBase, HotKeyItem hotKeyItem) {}
};
(listItemBase, hotKeyItem) -> {};

private final CategoryRenderer<HotKeyItem> keyBindingsRenderer =
new CategoryRenderer<HotKeyItem>() {
Expand Down Expand Up @@ -122,53 +114,22 @@ public HotKeysDialogViewImpl(
this.setWidget(uiBinder.createAndBindUi(this));

saveButton =
createButton(
locale.save(),
"keybindings-saveButton-btn",
new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
delegate.onSaveClicked();
}
});
addButtonToFooter(saveButton);
saveButton.addStyleName(resources.windowCss().primaryButton());
addFooterButton(
locale.save(), "keybindings-saveButton-btn", event -> delegate.onSaveClicked(), true);

closeButton =
createButton(
locale.close(),
"keybindings-closeButton-btn",
new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
delegate.onCloseClicked();
}
});
addButtonToFooter(closeButton);
addFooterButton(
locale.close(), "keybindings-closeButton-btn", event -> delegate.onCloseClicked());

printButton =
createButton(
locale.print(),
"keybindings-printButton-btn",
new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
delegate.onPrintClicked();
}
});
addButtonToFooter(printButton);
addFooterButton(
locale.print(), "keybindings-printButton-btn", event -> delegate.onPrintClicked());

list = new CategoriesList(res);
categoriesList = new ArrayList<>();
category.add(list);
filterInput.getElement().setAttribute("placeholder", "Search");
selectionListBox.addChangeHandler(
new ChangeHandler() {
@Override
public void onChange(ChangeEvent changeEvent) {
delegate.onSchemeSelectionChanged();
}
});
selectionListBox.addChangeHandler(changeEvent -> delegate.onSchemeSelectionChanged());

// Override DockLayoutPanel Overflow to correctly display ListBox
selectionPanel.getElement().getParentElement().getStyle().setOverflow(Style.Overflow.VISIBLE);
Expand All @@ -180,8 +141,17 @@ public void setDelegate(ActionDelegate delegate) {
}

@Override
public void hide() {
super.hide();
public void showDialog() {
show();
}

@Override
public void hideDialog() {
hide();
}

@Override
protected void onHide() {
resetFilter();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void show(@Nullable MacroChosenCallback callback) {

updateMacrosProvider(macroRegistry.getMacros());

view.show();
view.showDialog();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
public interface MacroChooserView extends View<MacroChooserView.ActionDelegate> {

/** Show the view. */
void show();
void showDialog();

/** Close the view. */
void close();
Expand Down
Loading