CHE-7163. Add ability to fast reveal and collapse resources
Signed-off-by: Roman Nikitenko <rnikiten@redhat.com>6.19.x
parent
6e22398356
commit
9183ae4035
|
|
@ -26,6 +26,12 @@ public interface CoreLocalizationConstant extends Messages {
|
|||
@Key("extension.category")
|
||||
String extensionCategory();
|
||||
|
||||
@Key("action.revealResource.text")
|
||||
String actionRevealResourceText();
|
||||
|
||||
@Key("action.revealResource.description")
|
||||
String actionRevealResourceDescription();
|
||||
|
||||
@Key("action.navigateToFile.text")
|
||||
String actionNavigateToFileText();
|
||||
|
||||
|
|
|
|||
|
|
@ -12,13 +12,9 @@ package org.eclipse.che.ide.actions;
|
|||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Singleton;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import org.eclipse.che.ide.CoreLocalizationConstant;
|
||||
import org.eclipse.che.ide.api.action.ActionEvent;
|
||||
import org.eclipse.che.ide.api.action.BaseAction;
|
||||
import org.eclipse.che.ide.api.parts.ActivePartChangedEvent;
|
||||
import org.eclipse.che.ide.api.parts.ActivePartChangedHandler;
|
||||
import org.eclipse.che.ide.api.parts.PartPresenter;
|
||||
import org.eclipse.che.ide.part.explorer.project.ProjectExplorerPresenter;
|
||||
|
||||
/**
|
||||
|
|
@ -27,37 +23,25 @@ import org.eclipse.che.ide.part.explorer.project.ProjectExplorerPresenter;
|
|||
* @author Vlad Zhukovskiy
|
||||
*/
|
||||
@Singleton
|
||||
public class CollapseAllAction extends BaseAction implements ActivePartChangedHandler {
|
||||
|
||||
public class CollapseAllAction extends BaseAction {
|
||||
private ProjectExplorerPresenter projectExplorer;
|
||||
|
||||
private PartPresenter activePart;
|
||||
|
||||
@Inject
|
||||
public CollapseAllAction(
|
||||
ProjectExplorerPresenter projectExplorer,
|
||||
EventBus eventBus,
|
||||
CoreLocalizationConstant localizationConstant) {
|
||||
ProjectExplorerPresenter projectExplorer, CoreLocalizationConstant localizationConstant) {
|
||||
super(
|
||||
localizationConstant.collapseAllActionTitle(),
|
||||
localizationConstant.collapseAllActionDescription());
|
||||
this.projectExplorer = projectExplorer;
|
||||
|
||||
eventBus.addHandler(ActivePartChangedEvent.TYPE, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(ActionEvent e) {
|
||||
e.getPresentation().setEnabledAndVisible(activePart instanceof ProjectExplorerPresenter);
|
||||
e.getPresentation().setEnabledAndVisible(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
projectExplorer.collapseAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivePartChanged(ActivePartChangedEvent event) {
|
||||
activePart = event.getActivePart();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@ import static org.eclipse.che.ide.api.constraints.Constraints.FIRST;
|
|||
import static org.eclipse.che.ide.api.constraints.Constraints.LAST;
|
||||
import static org.eclipse.che.ide.part.editor.recent.RecentFileStore.RECENT_GROUP_ID;
|
||||
import static org.eclipse.che.ide.projecttype.BlankProjectWizardRegistrar.BLANK_CATEGORY;
|
||||
import static org.eclipse.che.ide.util.input.KeyCodeMap.ARROW_DOWN;
|
||||
import static org.eclipse.che.ide.util.input.KeyCodeMap.ARROW_UP;
|
||||
|
||||
import com.google.gwt.resources.client.ClientBundle;
|
||||
import com.google.inject.Inject;
|
||||
|
|
@ -195,6 +197,8 @@ public class StandardComponentInitializer {
|
|||
public static final String EVENT_LOGS_DISPLAYING_MODE = "eventLogsDisplayingMode";
|
||||
public static final String EDITOR_DISPLAYING_MODE = "editorDisplayingMode";
|
||||
public static final String TERMINAL_DISPLAYING_MODE = "terminalDisplayingMode";
|
||||
public static final String REVEAL_RESOURCE = "revealResourceInProjectTree";
|
||||
public static final String COLLAPSE_ALL = "collapseAll";
|
||||
|
||||
public interface ParserResource extends ClientBundle {
|
||||
@Source("org/eclipse/che/ide/blank.svg")
|
||||
|
|
@ -602,9 +606,6 @@ public class StandardComponentInitializer {
|
|||
editGroup.add(switchPreviousEditorAction);
|
||||
editGroup.add(switchNextEditorAction);
|
||||
|
||||
editGroup.addSeparator();
|
||||
editGroup.add(revealResourceAction);
|
||||
|
||||
// Assistant (New Menu)
|
||||
DefaultActionGroup assistantGroup =
|
||||
(DefaultActionGroup) actionManager.getAction(GROUP_ASSISTANT);
|
||||
|
|
@ -691,6 +692,7 @@ public class StandardComponentInitializer {
|
|||
resourceOperation.add(downloadResourceAction);
|
||||
resourceOperation.add(refreshPathAction);
|
||||
resourceOperation.add(linkWithEditorAction);
|
||||
resourceOperation.add(collapseAllAction);
|
||||
resourceOperation.addSeparator();
|
||||
resourceOperation.add(convertFolderToProjectAction);
|
||||
resourceOperation.addSeparator();
|
||||
|
|
@ -711,6 +713,7 @@ public class StandardComponentInitializer {
|
|||
partMenuGroup.add(hidePartAction);
|
||||
partMenuGroup.add(restorePartAction);
|
||||
partMenuGroup.add(showConsoleTreeAction);
|
||||
partMenuGroup.add(revealResourceAction);
|
||||
partMenuGroup.add(collapseAllAction);
|
||||
partMenuGroup.add(refreshPathAction);
|
||||
partMenuGroup.add(linkWithEditorAction);
|
||||
|
|
@ -731,12 +734,12 @@ public class StandardComponentInitializer {
|
|||
actionManager.registerAction("goInto", goIntoAction);
|
||||
actionManager.registerAction(SHOW_REFERENCE, showReferenceAction);
|
||||
|
||||
actionManager.registerAction("collapseAll", collapseAllAction);
|
||||
actionManager.registerAction(REVEAL_RESOURCE, revealResourceAction);
|
||||
actionManager.registerAction(COLLAPSE_ALL, collapseAllAction);
|
||||
|
||||
actionManager.registerAction("openFile", openFileAction);
|
||||
actionManager.registerAction(SWITCH_LEFT_TAB, switchPreviousEditorAction);
|
||||
actionManager.registerAction(SWITCH_RIGHT_TAB, switchNextEditorAction);
|
||||
actionManager.registerAction("scrollFromSource", revealResourceAction);
|
||||
|
||||
changeResourceGroup.add(cutResourceAction);
|
||||
changeResourceGroup.add(copyResourceAction);
|
||||
|
|
@ -809,6 +812,9 @@ public class StandardComponentInitializer {
|
|||
editorContextMenuGroup.add(fullTextSearchAction);
|
||||
editorContextMenuGroup.add(closeActiveEditorAction);
|
||||
|
||||
editorContextMenuGroup.addSeparator();
|
||||
editorContextMenuGroup.add(revealResourceAction);
|
||||
|
||||
// Define hot-keys
|
||||
keyBinding
|
||||
.getGlobal()
|
||||
|
|
@ -883,6 +889,13 @@ public class StandardComponentInitializer {
|
|||
.getGlobal()
|
||||
.addKey(new KeyBuilder().alt().charCode('T').build(), TERMINAL_DISPLAYING_MODE);
|
||||
|
||||
keyBinding
|
||||
.getGlobal()
|
||||
.addKey(new KeyBuilder().action().charCode(ARROW_DOWN).build(), REVEAL_RESOURCE);
|
||||
keyBinding
|
||||
.getGlobal()
|
||||
.addKey(new KeyBuilder().action().charCode(ARROW_UP).build(), COLLAPSE_ALL);
|
||||
|
||||
if (UserAgent.isMac()) {
|
||||
keyBinding
|
||||
.getGlobal()
|
||||
|
|
|
|||
|
|
@ -471,9 +471,8 @@ public class ProjectExplorerPresenter extends BasePresenter
|
|||
}
|
||||
|
||||
/** Collapse all non-leaf nodes. */
|
||||
@Deprecated
|
||||
public void collapseAll() {
|
||||
view.collapseAll();
|
||||
doCollapse();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import com.google.inject.Singleton;
|
|||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import java.util.Map;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.eclipse.che.ide.CoreLocalizationConstant;
|
||||
import org.eclipse.che.ide.api.action.AbstractPerspectiveAction;
|
||||
import org.eclipse.che.ide.api.action.ActionEvent;
|
||||
import org.eclipse.che.ide.api.app.AppContext;
|
||||
|
|
@ -44,8 +45,12 @@ public class RevealResourceAction extends AbstractPerspectiveAction {
|
|||
private final EventBus eventBus;
|
||||
|
||||
@Inject
|
||||
public RevealResourceAction(AppContext appContext, EventBus eventBus) {
|
||||
super(singletonList(PROJECT_PERSPECTIVE_ID), "Reveal Resource");
|
||||
public RevealResourceAction(
|
||||
AppContext appContext, EventBus eventBus, CoreLocalizationConstant localizedConstant) {
|
||||
super(
|
||||
singletonList(PROJECT_PERSPECTIVE_ID),
|
||||
localizedConstant.actionRevealResourceText(),
|
||||
localizedConstant.actionRevealResourceDescription());
|
||||
this.appContext = appContext;
|
||||
this.eventBus = eventBus;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,6 +64,10 @@ projectExplorer.titleBar.text=Projects Explorer
|
|||
|
||||
projectExplorer.linkWithEditor.tooltip=Link with editor
|
||||
|
||||
############### Reveal Resource ###############
|
||||
action.revealResource.text=Reveal in project explorer
|
||||
action.revealResource.description=Reveal resource in project explorer
|
||||
|
||||
############### Navigate To File ###############
|
||||
action.navigateToFile.text = Navigate to File
|
||||
action.navigateToFile.description = Navigate to file
|
||||
|
|
|
|||
Loading…
Reference in New Issue