本文整理汇总了Java中com.intellij.ide.DeleteProvider.canDeleteElement方法的典型用法代码示例。如果您正苦于以下问题:Java DeleteProvider.canDeleteElement方法的具体用法?Java DeleteProvider.canDeleteElement怎么用?Java DeleteProvider.canDeleteElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.ide.DeleteProvider
的用法示例。
在下文中一共展示了DeleteProvider.canDeleteElement方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: canDeleteElement
import com.intellij.ide.DeleteProvider; //导入方法依赖的package包/类
@Override
public boolean canDeleteElement(@NotNull DataContext dataContext)
{
if(myEditor != null)
{
LwInspectionSuppression[] suppressions = dataContext.getData(LW_INSPECTION_SUPPRESSION_ARRAY_DATA_KEY);
if(suppressions != null)
{
return true;
}
DeleteProvider baseProvider = myEditor.getDataUnchecked(PlatformDataKeys.DELETE_ELEMENT_PROVIDER);
if(baseProvider != null)
{
return baseProvider.canDeleteElement(dataContext);
}
}
return false;
}
示例2: selectDelegate
import com.intellij.ide.DeleteProvider; //导入方法依赖的package包/类
@Nullable
private DeleteProvider selectDelegate(final DataContext dataContext) {
for (DeleteProvider provider : myProviders) {
if (provider.canDeleteElement(dataContext)) {
return provider;
}
}
return null;
}
示例3: canDeleteElement
import com.intellij.ide.DeleteProvider; //导入方法依赖的package包/类
public boolean canDeleteElement(@NotNull DataContext dataContext) {
if (myEditor != null) {
LwInspectionSuppression[] suppressions = LW_INSPECTION_SUPPRESSION_ARRAY_DATA_KEY.getData(dataContext);
if (suppressions != null) {
return true;
}
DeleteProvider baseProvider = (DeleteProvider) myEditor.getData(PlatformDataKeys.DELETE_ELEMENT_PROVIDER.getName());
if (baseProvider != null) {
return baseProvider.canDeleteElement(dataContext);
}
}
return false;
}
示例4: update
import com.intellij.ide.DeleteProvider; //导入方法依赖的package包/类
public void update(AnActionEvent event){
String place = event.getPlace();
Presentation presentation = event.getPresentation();
if (ActionPlaces.PROJECT_VIEW_POPUP.equals(place) || ActionPlaces.COMMANDER_POPUP.equals(place))
presentation.setText(IdeBundle.message("action.delete.ellipsis"));
else
presentation.setText(IdeBundle.message("action.delete"));
DataContext dataContext = event.getDataContext();
Project project = CommonDataKeys.PROJECT.getData(dataContext);
if (project == null) {
presentation.setEnabled(false);
return;
}
DeleteProvider provider = getDeleteProvider(dataContext);
if (event.getInputEvent() instanceof KeyEvent) {
KeyEvent keyEvent = (KeyEvent)event.getInputEvent();
Object component = PlatformDataKeys.CONTEXT_COMPONENT.getData(dataContext);
if (component instanceof JTextComponent) provider = null; // Do not override text deletion
if (keyEvent.getKeyCode() == KeyEvent.VK_BACK_SPACE) {
// Do not override text deletion in speed search
if (component instanceof JComponent) {
SpeedSearchSupply searchSupply = SpeedSearchSupply.getSupply((JComponent)component);
if (searchSupply != null) provider = null;
}
String activeSpeedSearchFilter = SpeedSearchSupply.SPEED_SEARCH_CURRENT_QUERY.getData(dataContext);
if (!StringUtil.isEmpty(activeSpeedSearchFilter)) {
provider = null;
}
}
}
if (provider instanceof TitledHandler) {
presentation.setText(((TitledHandler)provider).getActionTitle());
}
final boolean canDelete = provider != null && provider.canDeleteElement(dataContext);
if (ActionPlaces.isPopupPlace(event.getPlace())) {
presentation.setVisible(canDelete);
}
else {
presentation.setEnabled(canDelete);
}
}
示例5: update
import com.intellij.ide.DeleteProvider; //导入方法依赖的package包/类
public void update(AnActionEvent event){
String place = event.getPlace();
Presentation presentation = event.getPresentation();
if (ActionPlaces.PROJECT_VIEW_POPUP.equals(place) || ActionPlaces.COMMANDER_POPUP.equals(place))
presentation.setText(IdeBundle.message("action.delete.ellipsis"));
else
presentation.setText(IdeBundle.message("action.delete"));
DataContext dataContext = event.getDataContext();
Project project = PlatformDataKeys.PROJECT.getData(dataContext);
if (project == null) {
presentation.setEnabled(false);
return;
}
DeleteProvider provider = getDeleteProvider(dataContext);
if (event.getInputEvent() instanceof KeyEvent) {
KeyEvent keyEvent = (KeyEvent)event.getInputEvent();
Object component = PlatformDataKeys.CONTEXT_COMPONENT.getData(dataContext);
if (component instanceof JTextComponent) provider = null; // Do not override text deletion
if (keyEvent.getKeyCode() == KeyEvent.VK_BACK_SPACE) {
// Do not override text deletion in speed search
if (component instanceof JComponent) {
SpeedSearchSupply searchSupply = SpeedSearchSupply.getSupply((JComponent)component);
if (searchSupply != null) provider = null;
}
String activeSpeedSearchFilter = SpeedSearchSupply.SPEED_SEARCH_CURRENT_QUERY.getData(dataContext);
if (!StringUtil.isEmpty(activeSpeedSearchFilter)) {
provider = null;
}
}
}
if (provider instanceof TitledHandler) {
presentation.setText(((TitledHandler)provider).getActionTitle());
}
final boolean canDelete = provider != null && provider.canDeleteElement(dataContext);
if (ActionPlaces.isPopupPlace(event.getPlace())) {
presentation.setVisible(canDelete);
}
else {
presentation.setEnabled(canDelete);
}
}
示例6: update
import com.intellij.ide.DeleteProvider; //导入方法依赖的package包/类
public void update(AnActionEvent event){
String place = event.getPlace();
Presentation presentation = event.getPresentation();
if (ActionPlaces.PROJECT_VIEW_POPUP.equals(place) || ActionPlaces.COMMANDER_POPUP.equals(place))
presentation.setText(IdeBundle.message("action.delete.ellipsis"));
else
presentation.setText(IdeBundle.message("action.delete"));
DataContext dataContext = event.getDataContext();
Project project = event.getData(CommonDataKeys.PROJECT);
if (project == null) {
presentation.setEnabled(false);
return;
}
DeleteProvider provider = getDeleteProvider(dataContext);
if (event.getInputEvent() instanceof KeyEvent) {
KeyEvent keyEvent = (KeyEvent)event.getInputEvent();
Object component = event.getData(PlatformDataKeys.CONTEXT_COMPONENT);
if (component instanceof JTextComponent) provider = null; // Do not override text deletion
if (keyEvent.getKeyCode() == KeyEvent.VK_BACK_SPACE) {
// Do not override text deletion in speed search
if (component instanceof JComponent) {
SpeedSearchSupply searchSupply = SpeedSearchSupply.getSupply((JComponent)component);
if (searchSupply != null) provider = null;
}
String activeSpeedSearchFilter = event.getData(SpeedSearchSupply.SPEED_SEARCH_CURRENT_QUERY);
if (!StringUtil.isEmpty(activeSpeedSearchFilter)) {
provider = null;
}
}
}
if (provider instanceof TitledHandler) {
presentation.setText(((TitledHandler)provider).getActionTitle());
}
final boolean canDelete = provider != null && provider.canDeleteElement(dataContext);
if (ActionPlaces.isPopupPlace(event.getPlace())) {
presentation.setVisible(canDelete);
}
else {
presentation.setEnabled(canDelete);
}
}