Skip to content

Commit af3d892

Browse files
author
Vitaliy Guliy
committed
Fixing Go Into functionality
1 parent bf14b36 commit af3d892

10 files changed

Lines changed: 88 additions & 99 deletions

File tree

ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/parts/base/BaseView.java

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import com.google.gwt.user.client.ui.Composite;
1818
import com.google.gwt.user.client.ui.DockLayoutPanel;
1919
import com.google.gwt.user.client.ui.FocusWidget;
20-
import com.google.gwt.user.client.ui.IsWidget;
2120
import com.google.gwt.user.client.ui.Widget;
2221

2322
import org.eclipse.che.ide.api.mvp.View;
@@ -61,17 +60,6 @@ public BaseView() {
6160
initWidget(container);
6261
}
6362

64-
/**
65-
* Add a button on part toolbar,
66-
*
67-
* @param button button
68-
*/
69-
public final void addToolButton(@NotNull IsWidget button) {
70-
if (button != null) {
71-
// toolbarHeader.addEast(button, 18);
72-
}
73-
}
74-
7563
/** {@inheritDoc} */
7664
@Override
7765
public final void setDelegate(T delegate) {
@@ -101,7 +89,6 @@ public final void setContentWidget(Widget widget) {
10189
*/
10290
@Override
10391
public void setTitle(@NotNull String title) {
104-
// titleLabel.setText(title);
10592
}
10693

10794
/** {@inheritDoc} */
@@ -129,6 +116,9 @@ protected void focusView() {
129116
getElement().focus();
130117
}
131118

119+
/**
120+
* Handles loosing the focus.
121+
*/
132122
protected void blurView() {
133123
getElement().blur();
134124
}

ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/CoreLocalizationConstant.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ public interface CoreLocalizationConstant extends Messages {
5757
@Key("action.delete.description")
5858
String deleteItemActionDescription();
5959

60+
@Key("action.goInto.text")
61+
String goIntoActionText();
62+
63+
@Key("action.goBack.text")
64+
String goBackActionText();
65+
6066
/* Cut */
6167
@Key("action.cut.text")
6268
String cutItemsActionText();

ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/actions/GoIntoAction.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import com.google.inject.Inject;
1414
import com.google.inject.Singleton;
1515

16+
import org.eclipse.che.ide.CoreLocalizationConstant;
1617
import org.eclipse.che.ide.api.action.ActionEvent;
1718
import org.eclipse.che.ide.api.action.ProjectAction;
1819
import org.eclipse.che.ide.api.data.tree.Node;
@@ -30,16 +31,28 @@
3031
public class GoIntoAction extends ProjectAction {
3132

3233
private final ProjectExplorerPresenter projectExplorer;
34+
private final CoreLocalizationConstant localizationConstant;
3335

3436
@Inject
35-
public GoIntoAction(ProjectExplorerPresenter projectExplorer) {
36-
super("Go into");
37+
public GoIntoAction(ProjectExplorerPresenter projectExplorer,
38+
CoreLocalizationConstant localizationConstant) {
39+
super(localizationConstant.goIntoActionText());
40+
3741
this.projectExplorer = projectExplorer;
42+
this.localizationConstant = localizationConstant;
3843
}
3944

4045
/** {@inheritDoc} */
4146
@Override
4247
protected void updateProjectAction(ActionEvent e) {
48+
if (projectExplorer.isGoIntoActivated()) {
49+
e.getPresentation().setText(localizationConstant.goBackActionText());
50+
e.getPresentation().setEnabledAndVisible(true);
51+
return;
52+
}
53+
54+
e.getPresentation().setText(localizationConstant.goIntoActionText());
55+
4356
List<?> selection = projectExplorer.getSelection().getAllElements();
4457

4558
e.getPresentation().setEnabledAndVisible(!projectExplorer.isGoIntoActivated()
@@ -50,6 +63,11 @@ protected void updateProjectAction(ActionEvent e) {
5063
/** {@inheritDoc} */
5164
@Override
5265
public void actionPerformed(ActionEvent e) {
66+
if (projectExplorer.isGoIntoActivated()) {
67+
projectExplorer.goBack();
68+
return;
69+
}
70+
5371
List<?> selection = projectExplorer.getSelection().getAllElements();
5472

5573
if (selection.isEmpty() || selection.size() > 1) {
@@ -66,4 +84,5 @@ public void actionPerformed(ActionEvent e) {
6684
private boolean isNodeSupportGoInto(Object node) {
6785
return node instanceof Node && ((Node)node).supportGoInto();
6886
}
87+
6988
}

ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/toolbar/selector/PanelSelectorPresenter.java

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
import org.eclipse.che.ide.api.parts.Perspective;
2121
import org.eclipse.che.ide.api.parts.PerspectiveManager;
2222

23+
import static org.eclipse.che.ide.api.parts.PartStack.State.MINIMIZED;
24+
2325
/**
2426
* Presenter to manage Panel selector widget and perspective layout.
2527
*/
@@ -110,7 +112,7 @@ private void showPanels(boolean left, boolean bottom, boolean right) {
110112
PartStack rightPartStack = perspective.getPartStack(PartStackType.TOOLING);
111113

112114
if (left) {
113-
if (PartStack.State.MINIMIZED == leftPartStack.getPartStackState()) {
115+
if (MINIMIZED == leftPartStack.getPartStackState()) {
114116
leftPartStack.unMinimize();
115117
} else {
116118
leftPartStack.restore();
@@ -120,7 +122,7 @@ private void showPanels(boolean left, boolean bottom, boolean right) {
120122
}
121123

122124
if (bottom) {
123-
if (PartStack.State.MINIMIZED == bottomPartStack.getPartStackState()) {
125+
if (MINIMIZED == bottomPartStack.getPartStackState()) {
124126
bottomPartStack.unMinimize();
125127
} else {
126128
bottomPartStack.restore();
@@ -130,7 +132,7 @@ private void showPanels(boolean left, boolean bottom, boolean right) {
130132
}
131133

132134
if (right) {
133-
if (PartStack.State.MINIMIZED == rightPartStack.getPartStackState()) {
135+
if (MINIMIZED == rightPartStack.getPartStackState()) {
134136
rightPartStack.unMinimize();
135137
} else {
136138
rightPartStack.restore();
@@ -159,29 +161,29 @@ private void updateButtonState() {
159161
return;
160162
}
161163

162-
if (PartStack.State.MINIMIZED != leftPartStack.getPartStackState() &&
163-
PartStack.State.MINIMIZED == bottomPartStack.getPartStackState() &&
164-
PartStack.State.MINIMIZED == rightPartStack.getPartStackState()) {
164+
if (MINIMIZED != leftPartStack.getPartStackState() &&
165+
MINIMIZED == bottomPartStack.getPartStackState() &&
166+
MINIMIZED == rightPartStack.getPartStackState()) {
165167
view.setState(PanelSelectorView.State.LEFT);
166-
} else if (PartStack.State.MINIMIZED != leftPartStack.getPartStackState() &&
167-
PartStack.State.MINIMIZED != bottomPartStack.getPartStackState() &&
168-
PartStack.State.MINIMIZED == rightPartStack.getPartStackState()) {
168+
} else if (MINIMIZED != leftPartStack.getPartStackState() &&
169+
MINIMIZED != bottomPartStack.getPartStackState() &&
170+
MINIMIZED == rightPartStack.getPartStackState()) {
169171
view.setState(PanelSelectorView.State.LEFT_BOTTOM);
170-
} else if (PartStack.State.MINIMIZED == leftPartStack.getPartStackState() &&
171-
PartStack.State.MINIMIZED == bottomPartStack.getPartStackState() &&
172-
PartStack.State.MINIMIZED == rightPartStack.getPartStackState()) {
172+
} else if (MINIMIZED == leftPartStack.getPartStackState() &&
173+
MINIMIZED == bottomPartStack.getPartStackState() &&
174+
MINIMIZED == rightPartStack.getPartStackState()) {
173175
view.setState(PanelSelectorView.State.FULL_EDITOR);
174-
} else if (PartStack.State.MINIMIZED == leftPartStack.getPartStackState() &&
175-
PartStack.State.MINIMIZED != bottomPartStack.getPartStackState() &&
176-
PartStack.State.MINIMIZED == rightPartStack.getPartStackState()) {
176+
} else if (MINIMIZED == leftPartStack.getPartStackState() &&
177+
MINIMIZED != bottomPartStack.getPartStackState() &&
178+
MINIMIZED == rightPartStack.getPartStackState()) {
177179
view.setState(PanelSelectorView.State.BOTTOM);
178-
} else if (PartStack.State.MINIMIZED == leftPartStack.getPartStackState() &&
179-
PartStack.State.MINIMIZED == bottomPartStack.getPartStackState() &&
180-
PartStack.State.MINIMIZED != rightPartStack.getPartStackState()) {
180+
} else if (MINIMIZED == leftPartStack.getPartStackState() &&
181+
MINIMIZED == bottomPartStack.getPartStackState() &&
182+
MINIMIZED != rightPartStack.getPartStackState()) {
181183
view.setState(PanelSelectorView.State.RIGHT);
182-
} else if (PartStack.State.MINIMIZED != leftPartStack.getPartStackState() &&
183-
PartStack.State.MINIMIZED != bottomPartStack.getPartStackState() &&
184-
PartStack.State.MINIMIZED != rightPartStack.getPartStackState()) {
184+
} else if (MINIMIZED != leftPartStack.getPartStackState() &&
185+
MINIMIZED != bottomPartStack.getPartStackState() &&
186+
MINIMIZED != rightPartStack.getPartStackState()) {
185187
view.setState(PanelSelectorView.State.LEFT_RIGHT_BOTTOM);
186188
}
187189
}

ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/part/PartStackPresenter.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ public void collapse() {
380380
previousActivePart = activePart;
381381

382382
activeTab = null;
383-
activeTab = null;
383+
activePart = null;
384384

385385
// Notify the part stack state has been changed.
386386
Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
@@ -457,8 +457,13 @@ public void execute() {
457457
}
458458
});
459459

460-
activePart.onOpen();
461-
selectActiveTab(activeTab);
460+
if (activePart != null) {
461+
activePart.onOpen();
462+
}
463+
464+
if (activeTab != null) {
465+
selectActiveTab(activeTab);
466+
}
462467
}
463468

464469
@Override

ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/part/PartStackViewImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public void setWidget(IsWidget widget) {
113113
setMaximized(false);
114114

115115
addMaximizeButton();
116-
addMimimizeButton();
116+
addMinimizeButton();
117117
addMenuButton();
118118
}
119119

@@ -142,7 +142,7 @@ public void onClick(ClickEvent event) {
142142
/**
143143
* Adds button to minimize part stack.
144144
*/
145-
private void addMimimizeButton() {
145+
private void addMinimizeButton() {
146146
SVGImage minimize = new SVGImage(resources.collapseExpandIcon());
147147
minimize.getElement().setAttribute("name", "workBenchIconMinimize");
148148
ToolButton minimizeToolButton = new ToolButton(minimize);
@@ -170,7 +170,7 @@ private void addMenuButton() {
170170
menuButton.add(menuToolButton);
171171
menuToolButton.addClickHandler(new ClickHandler() {
172172
@Override
173-
public void onClick(final ClickEvent event) {
173+
public void onClick(ClickEvent event) {
174174
Scheduler.get().scheduleDeferred(() -> {
175175
int left = getAbsoluteLeft(menuToolButton.getElement());
176176
int top = getAbsoluteTop(menuToolButton.getElement());

ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/part/explorer/project/ProjectExplorerPresenter.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,8 +422,15 @@ public void go(AcceptsOneWidget container) {
422422
* node which should be activated in "Go Into" mode
423423
*/
424424
@Deprecated
425-
public void goInto(Node node) {
426-
view.setGoIntoModeOn(node);
425+
public boolean goInto(Node node) {
426+
return view.setGoIntoModeOn(node);
427+
}
428+
429+
/**
430+
* Deactivate "Go Into" mode.
431+
*/
432+
public void goBack() {
433+
view.setGoIntoModeOff();
427434
}
428435

429436
/**

ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/part/explorer/project/ProjectExplorerView.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ public interface ProjectExplorerView extends View<ProjectExplorerView.ActionDele
3434
*/
3535
boolean setGoIntoModeOn(Node node);
3636

37+
/**
38+
* Deactivate "Go Into" mode.
39+
*/
40+
void setGoIntoModeOff();
41+
3742
/**
3843
* Get "Go Into" state on current tree.
3944
*

0 commit comments

Comments
 (0)