本文整理汇总了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);
}
}
}
}
示例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;
}
示例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);
}
}
示例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;
}
示例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());
}
});
}
示例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;
}
示例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);
}
}
}
}
示例8: getDeleteProvider
import com.intellij.ide.DeleteProvider; //导入依赖的package包/类
protected DeleteProvider getDeleteProvider(DataContext dataContext) {
return new VirtualFileDeleteProvider();
}
示例9: getDeleteProvider
import com.intellij.ide.DeleteProvider; //导入依赖的package包/类
@Nullable
protected DeleteProvider getDeleteProvider(DataContext dataContext) {
return PlatformDataKeys.DELETE_ELEMENT_PROVIDER.getData(dataContext);
}
示例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);
}
}
示例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);
}
}
示例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()));
}
示例13: getDeleteProvider
import com.intellij.ide.DeleteProvider; //导入依赖的package包/类
@Override
public DeleteProvider getDeleteProvider() {
return myDelegate.getDeleteProvider();
}
示例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);
}
}
示例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());
}