such an awesome haul

remove ~40 unregistered or unused actions and components
This commit is contained in:
Sergey Ignatov
2018-12-29 02:53:23 +03:00
parent 0d27744468
commit 50af1cfd32
18 changed files with 8 additions and 670 deletions
@@ -1,25 +0,0 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.debugger.ui.tree.actions;
import com.intellij.debugger.settings.NodeRendererSettings;
public class ShowAllAsDecimal extends ShowAllAs{
public ShowAllAsDecimal() {
super(NodeRendererSettings.getInstance().getPrimitiveRenderer());
}
}
@@ -1,25 +0,0 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.debugger.ui.tree.actions;
import com.intellij.debugger.settings.NodeRendererSettings;
public class ShowAllAsHex extends ShowAllAs {
public ShowAllAsHex() {
super(NodeRendererSettings.getInstance().getHexRenderer());
}
}
@@ -20,19 +20,25 @@
*/
package com.intellij.execution.ui.layout.actions;
import com.intellij.execution.ui.layout.impl.RunnerContentUi;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.project.DumbAwareAction;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class RestoreLayoutAction extends DumbAwareAction {
@Nullable
public static RunnerContentUi getRunnerUi(@NotNull AnActionEvent e) {
return RunnerContentUi.KEY.getData(e.getDataContext());
}
@Override
public void actionPerformed(@NotNull final AnActionEvent e) {
ToggleToolbarLayoutAction.getRunnerUi(e).restoreLayout();
getRunnerUi(e).restoreLayout();
}
@Override
public void update(@NotNull final AnActionEvent e) {
e.getPresentation().setEnabled(ToggleToolbarLayoutAction.getRunnerUi(e) != null);
e.getPresentation().setEnabled(getRunnerUi(e) != null);
}
}
@@ -1,53 +0,0 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.execution.ui.layout.actions;
import com.intellij.execution.ui.layout.impl.RunnerContentUi;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.ToggleAction;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class ToggleToolbarLayoutAction extends ToggleAction {
@Override
public void update(@NotNull final AnActionEvent e) {
if (getRunnerUi(e) == null) {
e.getPresentation().setEnabled(false);
}
else {
super.update(e);
}
}
@Override
public boolean isSelected(@NotNull AnActionEvent e) {
RunnerContentUi ui = getRunnerUi(e);
return ui != null && ui.isHorizontalToolbar();
}
@Override
public void setSelected(@NotNull AnActionEvent e, boolean state) {
RunnerContentUi ui = getRunnerUi(e);
assert ui != null;
ui.setHorizontalToolbar(state);
}
@Nullable
public static RunnerContentUi getRunnerUi(@NotNull AnActionEvent e) {
return RunnerContentUi.KEY.getData(e.getDataContext());
}
}
@@ -1,47 +0,0 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.openapi.vfs.encoding;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.options.ShowSettingsUtil;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
public class ConfigureFileDefaultEncodingAction extends AnAction {
@Override
public void actionPerformed(@NotNull final AnActionEvent e) {
final Project project = e.getData(CommonDataKeys.PROJECT);
final VirtualFile virtualFile = e.getData(CommonDataKeys.VIRTUAL_FILE);
assert project != null;
final FileEncodingConfigurable configurable = new FileEncodingConfigurable(project);
ShowSettingsUtil.getInstance().editConfigurable(project, configurable, () -> {
if (virtualFile != null) {
configurable.selectFile(virtualFile);
}
});
}
@Override
public void update(@NotNull final AnActionEvent e) {
e.getPresentation().setEnabled(e.getData(CommonDataKeys.PROJECT) != null);
}
}
@@ -1,23 +0,0 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.ide.errorTreeView.actions;
import com.intellij.ide.errorTreeView.NewErrorTreeViewPanel;
import com.intellij.openapi.project.Project;
import com.intellij.util.ui.ErrorTreeView;
import org.jetbrains.annotations.NonNls;
/**
* @author Eugene Zhuravlev
*/
public class TestNewErrorViewAction extends TestErrorViewAction{
@Override
protected ErrorTreeView createView(Project project) {
return new NewErrorTreeViewPanel(project, null);
}
@Override
@NonNls
protected String getContentName() {
return "NewView";
}
}
@@ -1,83 +0,0 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.diff.actions;
import com.intellij.ide.highlighter.ArchiveFileType;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.diff.DiffBundle;
import com.intellij.openapi.diff.DiffManager;
import com.intellij.openapi.diff.DiffRequest;
import com.intellij.openapi.diff.SimpleDiffRequest;
import com.intellij.openapi.diff.ex.DiffContentFactory;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* @deprecated use {@link com.intellij.diff.actions.CompareFilesAction} instead
*/
@Deprecated
public class CompareFiles extends BaseDiffAction {
public static final DataKey<DiffRequest> DIFF_REQUEST = DataKey.create("CompareFiles.DiffRequest");
@Override
public void update(@NotNull AnActionEvent e) {
Presentation presentation = e.getPresentation();
boolean canShow = isAvailable(e);
if (ActionPlaces.isPopupPlace(e.getPlace())) {
presentation.setVisible(canShow);
}
else {
presentation.setVisible(true);
presentation.setEnabled(canShow);
}
}
private static boolean isAvailable(@NotNull AnActionEvent e) {
final Project project = e.getData(CommonDataKeys.PROJECT);
DiffRequest diffRequest = e.getData(DIFF_REQUEST);
if (diffRequest == null) {
final VirtualFile[] virtualFiles = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY);
if (virtualFiles == null || virtualFiles.length != 2) {
return false;
}
diffRequest = getDiffRequest(project, virtualFiles);
}
if (diffRequest == null) {
return false;
}
return DiffManager.getInstance().getDiffTool().canShow(diffRequest);
}
@Override
protected DiffRequest getDiffData(DataContext dataContext) {
final Project project = CommonDataKeys.PROJECT.getData(dataContext);
final DiffRequest diffRequest = DIFF_REQUEST.getData(dataContext);
if (diffRequest != null) {
return diffRequest;
}
final VirtualFile[] data = CommonDataKeys.VIRTUAL_FILE_ARRAY.getData(dataContext);
if (data == null || data.length != 2) {
return null;
}
return getDiffRequest(project, data);
}
@Nullable
private static DiffRequest getDiffRequest(Project project, VirtualFile[] files) {
if (files == null || files.length != 2) return null;
if (files[0].isDirectory() || files[1].isDirectory()
|| files[0].getFileType() instanceof ArchiveFileType
|| files[1].getFileType() instanceof ArchiveFileType) {
return null;
}
String title = DiffBundle.message("diff.element.qualified.name.vs.element.qualified.name.dialog.title",
getVirtualFileContentTitle(files [0]),
getVirtualFileContentTitle(files [1]));
SimpleDiffRequest diffRequest = DiffContentFactory.compareVirtualFiles(project, files[0], files[1], title);
if (diffRequest == null) return null;
diffRequest.setContentTitles(getVirtualFileContentTitle(files [0]),
getVirtualFileContentTitle(files [1]));
return diffRequest;
}
}
@@ -1,79 +0,0 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.wm.impl.status;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.Task;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;
@SuppressWarnings({"HardCodedStringLiteral"})
public class AddModalTestProcessAction extends AnAction implements DumbAware {
public AddModalTestProcessAction() {
super("Add Test Process");
}
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
final Project project = e.getData(CommonDataKeys.PROJECT);
new Task.Modal(project, "Test Process", true) {
@Override
public void run(@NotNull final ProgressIndicator indicator) {
try {
indicator.setText("welcome!");
Thread.sleep(6000);
countTo(1000, new Count() {
@Override
public void onCount(int each) {
indicator.setText("Found: " + each / 20 + 1);
if (each / 10.0 == Math.round(each / 10.0)) {
indicator.setText(null);
}
indicator.setFraction(each / 1000.0);
try {
Thread.sleep(100);
}
catch (InterruptedException e1) {
e1.printStackTrace();
}
indicator.checkCanceled();
indicator.setText2("bla bla bla");
}
});
indicator.stop();
}
catch (ProcessCanceledException e1) {
try {
Thread.sleep(2000);
indicator.stop();
}
catch (InterruptedException e2) {
e2.printStackTrace();
}
}
catch (InterruptedException e1) {
e1.printStackTrace();
}
}
}.queue();
}
private static void countTo(int top, Count count) {
for (int i = 0; i < top; i++) {
count.onCount(i);
}
}
private interface Count {
void onCount(int each);
}
}
@@ -679,7 +679,6 @@
<reference ref="RunContextGroup"/>
</group>
<!-- <action id="UsageView.ImportToFavorites" class="com.intellij.ide.favoritesTreeView.ImportUsagesAction"/> -->
<action id="NewElementSamePlace" class="com.intellij.ide.actions.NewElementSamePlaceAction"/>
<action id="ChangeCodeStyleScheme" class="com.intellij.ide.actions.QuickChangeCodeStyleSchemeAction">
@@ -869,8 +868,6 @@
<action id="XDebugger.Inline" class="com.intellij.xdebugger.impl.actions.UseInlineDebuggerAction"/>
<separator/>
<reference ref="XDebugger.ToggleSortValues"/>
<!--<action id="XDebugger.AutoTooltip" class="com.intellij.xdebugger.impl.actions.ValueTooltipAutoShowAction"/>-->
<!--<action id="XDebugger.AutoTooltipOnSelection" class="com.intellij.xdebugger.impl.actions.ValueTooltipAutoShowOnSelectionAction"/>-->
<separator/>
<action id="XDebugger.UnmuteOnStop" class="com.intellij.xdebugger.impl.actions.UnmuteOnStopAction" />
</group>
@@ -258,10 +258,6 @@
<action id="IncomingChanges.Refresh" class="com.intellij.openapi.vcs.changes.committed.RefreshIncomingChangesAction"
icon="AllIcons.Actions.Refresh"/>
<reference ref="CommittedChanges.Details"/>
<!--
<action id="IncomingChanges.Get" class="com.intellij.openapi.vcs.changes.committed.GetCommittedChangelistAction"
icon="/actions/get.png"/>
-->
<reference ref="Vcs.UpdateProject"/>
</group>
@@ -1,24 +0,0 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.xdebugger.impl.actions;
import com.intellij.openapi.actionSystem.RegistryToggleAction;
public class ValueTooltipAutoShowAction extends RegistryToggleAction {
public ValueTooltipAutoShowAction() {
super("debugger.valueTooltipAutoShow");
}
}
@@ -1,27 +0,0 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.xdebugger.impl.actions;
import com.intellij.openapi.actionSystem.RegistryToggleAction;
/**
* @author Konstantin Bulenkov
*/
public class ValueTooltipAutoShowOnSelectionAction extends RegistryToggleAction {
public ValueTooltipAutoShowOnSelectionAction() {
super("debugger.valueTooltipAutoShowOnSelection");
}
}
@@ -1,30 +0,0 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.ide.actions;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DefaultActionGroup;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.wm.ToolWindowId;
import com.intellij.openapi.wm.ToolWindowManager;
import org.jetbrains.annotations.NotNull;
public class CommanderViewActionGroup extends DefaultActionGroup implements DumbAware {
public CommanderViewActionGroup() {
super();
}
@Override
public void update(@NotNull AnActionEvent e){
Presentation presentation = e.getPresentation();
Project project = e.getProject();
if (project == null) {
presentation.setVisible(false);
return;
}
String id = ToolWindowManager.getInstance(project).getActiveToolWindowId();
boolean isCommanderActive = ToolWindowId.COMMANDER.equals(id);
presentation.setVisible(isCommanderActive);
}
}
@@ -16,85 +16,19 @@
package org.jetbrains.settingsRepository.actions
import com.intellij.openapi.components.ServiceManager
import com.intellij.openapi.components.StorageScheme
import com.intellij.openapi.project.Project
import com.intellij.openapi.project.ex.ProjectEx
import com.intellij.openapi.ui.DialogWrapper
import com.intellij.openapi.ui.MessageDialogBuilder
import com.intellij.openapi.ui.Messages
import com.intellij.openapi.util.io.FileUtil
import com.intellij.openapi.vcs.CheckinProjectPanel
import com.intellij.openapi.vcs.FilePath
import com.intellij.openapi.vcs.FileStatus
import com.intellij.openapi.vcs.actions.CommonCheckinFilesAction
import com.intellij.openapi.vcs.actions.VcsContext
import com.intellij.openapi.vcs.changes.Change
import com.intellij.openapi.vcs.changes.ChangeListManager
import com.intellij.openapi.vcs.changes.CommitContext
import com.intellij.openapi.vcs.changes.CommitExecutor
import com.intellij.openapi.vcs.checkin.BeforeCheckinDialogHandler
import com.intellij.openapi.vcs.checkin.CheckinHandler
import com.intellij.openapi.vcs.checkin.CheckinHandlerFactory
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.project.stateStore
import com.intellij.util.SmartList
import org.jetbrains.settingsRepository.CommitToIcsDialog
import org.jetbrains.settingsRepository.ProjectId
import org.jetbrains.settingsRepository.icsManager
import org.jetbrains.settingsRepository.icsMessage
import java.util.*
class CommitToIcsAction : CommonCheckinFilesAction() {
class IcsBeforeCommitDialogHandler : CheckinHandlerFactory() {
override fun createHandler(panel: CheckinProjectPanel, commitContext: CommitContext): CheckinHandler {
return CheckinHandler.DUMMY
}
override fun createSystemReadyHandler(project: Project): BeforeCheckinDialogHandler? {
return BEFORE_CHECKIN_DIALOG_HANDLER
}
companion object {
private val BEFORE_CHECKIN_DIALOG_HANDLER = object : BeforeCheckinDialogHandler() {
override fun beforeCommitDialogShown(project: Project, changes: List<Change>, executors: Iterable<CommitExecutor>, showVcsCommit: Boolean): Boolean {
val collectConsumer = ProjectChangeCollectConsumer(project)
collectProjectChanges(changes, collectConsumer)
showDialog(project, collectConsumer, null)
return true
}
}
}
}
override fun getActionName(dataContext: VcsContext): String = icsMessage("action.CommitToIcs.text")
override fun isApplicableRoot(file: VirtualFile, status: FileStatus, dataContext: VcsContext): Boolean {
val project = dataContext.project
return project is ProjectEx && project.stateStore.storageScheme == StorageScheme.DIRECTORY_BASED && super.isApplicableRoot(file, status, dataContext) && !file.isDirectory && isProjectConfigFile(file, dataContext.project!!)
}
override fun prepareRootsForCommit(roots: Array<FilePath>, project: Project): Array<FilePath> = roots
override fun performCheckIn(context: VcsContext, project: Project, roots: Array<out FilePath>) {
val projectId = getProjectId(project) ?: return
val changes = context.selectedChanges
val collectConsumer = ProjectChangeCollectConsumer(project)
if (changes != null && changes.isNotEmpty()) {
for (change in changes) {
collectConsumer.consume(change)
}
}
else {
val manager = ChangeListManager.getInstance(project)
for (path in getRoots(context)) {
collectProjectChanges(manager.getChangesIn(path), collectConsumer)
}
}
showDialog(project, collectConsumer, projectId)
}
}
private class ProjectChangeCollectConsumer(private val project: Project) {
private var projectChanges: MutableList<Change>? = null
@@ -86,16 +86,6 @@
<add-to-group group-id="MainToolBar" anchor="last"/>
<add-to-group group-id="NavBarToolBarOthers" anchor="last"/>
</group>
<!--
<action id="tasks.trackContext" class="com.intellij.tasks.actions.AssociateWithTaskAction"
text="Associate with _Task"
description="Reload context (e.g. open editors) when changelist is set active">
<add-to-group group-id="ChangesViewPopupMenu" relative-to-action="ChangesView.SetDefault" anchor="after"/>
</action>
-->
</actions>
<extensionPoints>
@@ -1,75 +0,0 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.tasks.actions;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.ToggleAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.vcs.changes.ChangeList;
import com.intellij.openapi.vcs.changes.LocalChangeList;
import com.intellij.openapi.vcs.VcsDataKeys;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.DumbAware;
import com.intellij.tasks.TaskManager;
import org.jetbrains.annotations.NotNull;
/**
* @author Dmitry Avdeev
*/
public class AssociateWithTaskAction extends ToggleAction implements DumbAware {
@Override
public void update(@NotNull AnActionEvent e) {
boolean isChangelist = e.getData(VcsDataKeys.CHANGE_LISTS) == null;
e.getPresentation().setVisible(isChangelist);
if (isChangelist) {
super.update(e);
}
}
@Override
public boolean isSelected(@NotNull AnActionEvent e) {
ChangeList[] lists = e.getData(VcsDataKeys.CHANGE_LISTS);
if (lists == null) {
return false;
}
Project project = e.getData(CommonDataKeys.PROJECT);
TaskManager manager = TaskManager.getManager(project);
for (ChangeList list : lists) {
if (list instanceof LocalChangeList && manager.getAssociatedTask((LocalChangeList)list) == null) {
return false;
}
}
return true;
}
@Override
public void setSelected(@NotNull AnActionEvent e, boolean state) {
ChangeList[] lists = e.getData(VcsDataKeys.CHANGE_LISTS);
if (lists == null) {
return;
}
Project project = e.getData(CommonDataKeys.PROJECT);
TaskManager manager = TaskManager.getManager(project);
for (ChangeList list : lists) {
if (list instanceof LocalChangeList) {
manager.trackContext((LocalChangeList)list);
}
}
}
}
-10
View File
@@ -28,14 +28,4 @@
<extensions defaultExtensionNs="com.intellij">
<applicationService serviceImplementation="com.intellij.xdebugger.memory.component.MemoryViewManager"/>
</extensions>
<!--
<actions>
<group id="CommonViews">
<add-to-group group-id="Debugger.Representation" anchor="after" relative-to-action="Debugger.AutoRenderer"/>
<action id="Debugger.ShowAllAsHex" class="com.intellij.debugger.ui.tree.actions.ShowAllAsHex" text="Hex Array"/>
<action id="Debugger.ShowAllAsDecimal" class="com.intellij.debugger.ui.tree.actions.ShowAllAsDecimal" text="Decimal Array"/>
</group>
</actions>
-->
</idea-plugin>
@@ -1,84 +0,0 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.util.xml.tree.actions;
import com.intellij.icons.AllIcons;
import com.intellij.ide.TypePresentationService;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.ToggleAction;
import com.intellij.util.xml.DomUtil;
import com.intellij.util.xml.ElementPresentationManager;
import com.intellij.util.xml.tree.AbstractDomElementNode;
import com.intellij.util.xml.tree.BaseDomElementNode;
import com.intellij.util.xml.tree.DomModelTreeView;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.HashMap;
import java.util.Map;
public class DomElementsToggleAction extends ToggleAction {
private final DomModelTreeView myTreeView;
private final Class myClass;
private final Icon myIcon;
private final String myText;
public DomElementsToggleAction(final DomModelTreeView treeView, final Class aClass) {
myTreeView = treeView;
myClass = aClass;
Icon myIcon = ElementPresentationManager.getIcon(myClass);
if (myIcon == null) {
myIcon = AllIcons.Nodes.Pointcut;
}
this.myIcon = myIcon;
myText = TypePresentationService.getService().getTypePresentableName(myClass);
if(getHiders() == null) DomUtil.getFile(myTreeView.getRootElement()).putUserData(AbstractDomElementNode.TREE_NODES_HIDERS_KEY,
new HashMap<>());
getHiders().putIfAbsent(myClass, true);
}
@Override
public void update(@NotNull final AnActionEvent e) {
super.update(e);
e.getPresentation().setIcon(myIcon);
e.getPresentation().setText((getHiders().get(myClass) ? "Hide ":"Show ")+myText);
e.getPresentation().setEnabled(getHiders() != null && getHiders().get(myClass)!=null);
}
@Override
public boolean isSelected(@NotNull AnActionEvent e) {
return getHiders().get(myClass);
}
private Map<Class, Boolean> getHiders() {
return DomUtil.getFile(myTreeView.getRootElement()).getUserData(BaseDomElementNode.TREE_NODES_HIDERS_KEY);
}
@Override
public void setSelected(@NotNull AnActionEvent e, boolean state) {
getHiders().put(myClass, state);
myTreeView.getBuilder().updateFromRoot();
}
}