-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CHE-2521: improve clear recent list action
Signed-off-by: Oleksii Orel <oorel@codenvy.com>
- Loading branch information
Oleksii Orel
committed
Sep 22, 2016
1 parent
e96d45b
commit 4255d96
Showing
3 changed files
with
89 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...e-ide-app/src/main/java/org/eclipse/che/ide/part/editor/recent/ClearRecentListAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2012-2016 Codenvy, S.A. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Codenvy, S.A. - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.che.ide.part.editor.recent; | ||
|
||
import com.google.inject.Inject; | ||
import com.google.inject.Singleton; | ||
|
||
import org.eclipse.che.ide.CoreLocalizationConstant; | ||
import org.eclipse.che.ide.api.action.AbstractPerspectiveAction; | ||
import org.eclipse.che.ide.api.action.ActionEvent; | ||
|
||
import javax.validation.constraints.NotNull; | ||
|
||
import static java.util.Collections.singletonList; | ||
import static org.eclipse.che.ide.workspace.perspectives.project.ProjectPerspective.PROJECT_PERSPECTIVE_ID; | ||
|
||
/** | ||
* Action clears list of recently opened files. | ||
* | ||
* @author Oleksii Orel | ||
*/ | ||
@Singleton | ||
public class ClearRecentListAction extends AbstractPerspectiveAction { | ||
|
||
private RecentFileList recentFileList; | ||
|
||
@Inject | ||
public ClearRecentListAction(RecentFileList recentFileList, | ||
CoreLocalizationConstant locale) { | ||
super(singletonList(PROJECT_PERSPECTIVE_ID), locale.openRecentFileClearTitle(), locale.openRecentFileClearDescription(), null, | ||
null); | ||
|
||
this.recentFileList = recentFileList; | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
@Override | ||
public void updateInPerspective(@NotNull ActionEvent event) { | ||
event.getPresentation().setEnabledAndVisible(!recentFileList.isEmpty()); | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
@Override | ||
public void actionPerformed(ActionEvent e) { | ||
recentFileList.clear(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters