当前位置: 首页>>代码示例>>Java>>正文


Java DeleteProvider类代码示例

本文整理汇总了Java中com.intellij.ide.DeleteProvider的典型用法代码示例。如果您正苦于以下问题:Java DeleteProvider类的具体用法?Java DeleteProvider怎么用?Java DeleteProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DeleteProvider类属于com.intellij.ide包,在下文中一共展示了DeleteProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deleteElement

import com.intellij.ide.DeleteProvider; //导入依赖的package包/类
public void deleteElement(@NotNull DataContext dataContext) {
  if (myEditor != null) {
    LwInspectionSuppression[] suppressions = LW_INSPECTION_SUPPRESSION_ARRAY_DATA_KEY.getData(dataContext);
    if (suppressions != null) {
      if (!myEditor.ensureEditable()) return;
      for(LwInspectionSuppression suppression: suppressions) {
        myEditor.getRootContainer().removeInspectionSuppression(suppression);
      }
      myEditor.refreshAndSave(true);
    }
    else {
      DeleteProvider baseProvider = (DeleteProvider) myEditor.getData(PlatformDataKeys.DELETE_ELEMENT_PROVIDER.getName());
      if (baseProvider != null) {
        baseProvider.deleteElement(dataContext);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ComponentTree.java

示例2: 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;
}
 
开发者ID:consulo,项目名称:consulo-ui-designer,代码行数:19,代码来源:ComponentTree.java

示例3: actionPerformed

import com.intellij.ide.DeleteProvider; //导入依赖的package包/类
public void actionPerformed(AnActionEvent e) {
  DataContext dataContext = e.getDataContext();
  DeleteProvider provider = getDeleteProvider(dataContext);
  if (provider == null) return;
  try {
    provider.deleteElement(dataContext);
  }
  catch (Throwable t) {
    if (t instanceof StackOverflowError){
      t.printStackTrace();
    }
    LOG.error(t);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:DeleteAction.java

示例4: 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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ShelvedChangesViewManager.java

示例5: actionPerformed

import com.intellij.ide.DeleteProvider; //导入依赖的package包/类
public void actionPerformed(final AnActionEvent e) {
  DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
    @Override
    public void run() {
      DeleteProvider deleteProvider = e.getData(PlatformDataKeys.DELETE_ELEMENT_PROVIDER);
      if (deleteProvider == null) return;
      deleteProvider.deleteElement(e.getDataContext());
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:DeleteUnversionedFilesAction.java

示例6: 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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:ComponentTree.java

示例7: deleteElement

import com.intellij.ide.DeleteProvider; //导入依赖的package包/类
@Override
public void deleteElement(@NotNull DataContext dataContext)
{
	if(myEditor != null)
	{
		LwInspectionSuppression[] suppressions = dataContext.getData(LW_INSPECTION_SUPPRESSION_ARRAY_DATA_KEY);
		if(suppressions != null)
		{
			if(!myEditor.ensureEditable())
			{
				return;
			}
			for(LwInspectionSuppression suppression : suppressions)
			{
				myEditor.getRootContainer().removeInspectionSuppression(suppression);
			}
			myEditor.refreshAndSave(true);
		}
		else
		{
			DeleteProvider baseProvider = myEditor.getDataUnchecked(PlatformDataKeys.DELETE_ELEMENT_PROVIDER);
			if(baseProvider != null)
			{
				baseProvider.deleteElement(dataContext);
			}
		}
	}
}
 
开发者ID:consulo,项目名称:consulo-ui-designer,代码行数:29,代码来源:ComponentTree.java

示例8: getDeleteProvider

import com.intellij.ide.DeleteProvider; //导入依赖的package包/类
protected DeleteProvider getDeleteProvider(DataContext dataContext) {
  return new VirtualFileDeleteProvider();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:FileDeleteAction.java

示例9: getDeleteProvider

import com.intellij.ide.DeleteProvider; //导入依赖的package包/类
@Nullable
protected DeleteProvider getDeleteProvider(DataContext dataContext) {
  return PlatformDataKeys.DELETE_ELEMENT_PROVIDER.getData(dataContext);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:DeleteAction.java

示例10: 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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:43,代码来源:DeleteAction.java

示例11: deleteElement

import com.intellij.ide.DeleteProvider; //导入依赖的package包/类
public void deleteElement(@NotNull DataContext dataContext) {
  final DeleteProvider delegate = selectDelegate(dataContext);
  if (delegate != null) {
    delegate.deleteElement(dataContext);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:ShelvedChangesViewManager.java

示例12: update

import com.intellij.ide.DeleteProvider; //导入依赖的package包/类
@Override
public void update(AnActionEvent e) {
  DeleteProvider deleteProvider = e.getData(PlatformDataKeys.DELETE_ELEMENT_PROVIDER);
  e.getPresentation().setVisible(deleteProvider != null && deleteProvider.canDeleteElement(e.getDataContext()));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:DeleteUnversionedFilesAction.java

示例13: getDeleteProvider

import com.intellij.ide.DeleteProvider; //导入依赖的package包/类
@Override
public DeleteProvider getDeleteProvider() {
  return myDelegate.getDeleteProvider();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:EditorWindowImpl.java

示例14: 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);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:43,代码来源:DeleteAction.java

示例15: actionPerformed

import com.intellij.ide.DeleteProvider; //导入依赖的package包/类
public void actionPerformed(AnActionEvent e) {
  DeleteProvider deleteProvider = e.getData(PlatformDataKeys.DELETE_ELEMENT_PROVIDER);
  if (deleteProvider == null) return;
  deleteProvider.deleteElement(e.getDataContext());
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:6,代码来源:DeleteUnversionedFilesAction.java


注:本文中的com.intellij.ide.DeleteProvider类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。