本文整理汇总了Java中com.intellij.ide.CopyProvider类的典型用法代码示例。如果您正苦于以下问题:Java CopyProvider类的具体用法?Java CopyProvider怎么用?Java CopyProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CopyProvider类属于com.intellij.ide包,在下文中一共展示了CopyProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: actionPerformed
import com.intellij.ide.CopyProvider; //导入依赖的package包/类
public void actionPerformed(AnActionEvent e) {
DataContext dataContext = e.getDataContext();
CopyProvider provider = PlatformDataKeys.COPY_PROVIDER.getData(dataContext);
if (provider == null) {
return;
}
provider.performCopy(dataContext);
Transferable contents = CopyPasteManager.getInstance().getContents();
String string;
try {
string = contents == null? null : (String)contents.getTransferData(DataFlavor.stringFlavor);
}
catch (Exception ex) {
return;
}
if (StringUtil.isNotEmpty(string)) {
BrowserUtil.launchBrowser("http://www.google.com/search?q="+ URLEncoder.encode(string));
}
}
示例2: actionPerformed
import com.intellij.ide.CopyProvider; //导入依赖的package包/类
public void actionPerformed(AnActionEvent e) {
DataContext dataContext = e.getDataContext();
CopyProvider provider = e.getData(PlatformDataKeys.COPY_PROVIDER);
if (provider == null) {
return;
}
provider.performCopy(dataContext);
Transferable contents = CopyPasteManager.getInstance().getContents();
String string;
try {
string = contents == null? null : (String)contents.getTransferData(DataFlavor.stringFlavor);
}
catch (Exception ex) {
return;
}
if (StringUtil.isNotEmpty(string)) {
BrowserUtil.browse("http://www.google.com/search?q="+ URLEncoder.encode(string));
}
}
示例3: actionPerformed
import com.intellij.ide.CopyProvider; //导入依赖的package包/类
public void actionPerformed(AnActionEvent var1) {
DataContext var2 = var1.getDataContext();
CopyProvider var3 = (CopyProvider) PlatformDataKeys.COPY_PROVIDER.getData(var2);
if (var3 != null) {
var3.performCopy(var2);
String var4 = (String) CopyPasteManager.getInstance().getContents(DataFlavor.stringFlavor);
if (StringUtil.isNotEmpty(var4)) {
BrowserUtil.browse("https://translate.google.com/#en/zh-CN/" + URLEncoder.encode(var4));
}
}
}
示例4: update
import com.intellij.ide.CopyProvider; //导入依赖的package包/类
public void update(AnActionEvent var1) {
Presentation var2 = var1.getPresentation();
DataContext var3 = var1.getDataContext();
CopyProvider var4 = (CopyProvider) PlatformDataKeys.COPY_PROVIDER.getData(var3);
boolean var5 = var4 != null && var4.isCopyEnabled(var3) && var4.isCopyVisible(var3);
var2.setEnabled(var5);
var2.setVisible(var5);
}
示例5: actionPerformed
import com.intellij.ide.CopyProvider; //导入依赖的package包/类
public void actionPerformed(AnActionEvent var1) {
DataContext var2 = var1.getDataContext();
CopyProvider var3 = (CopyProvider) PlatformDataKeys.COPY_PROVIDER.getData(var2);
if (var3 != null) {
var3.performCopy(var2);
String var4 = (String) CopyPasteManager.getInstance().getContents(DataFlavor.stringFlavor);
if (StringUtil.isNotEmpty(var4)) {
BrowserUtil.browse("https://www.baidu.com/s?wd=" + URLEncoder.encode(var4));
}
}
}
示例6: actionPerformed
import com.intellij.ide.CopyProvider; //导入依赖的package包/类
public void actionPerformed(AnActionEvent e) {
DataContext dataContext = e.getDataContext();
CopyProvider provider = PlatformDataKeys.COPY_PROVIDER.getData(dataContext);
if (provider == null) {
return;
}
provider.performCopy(dataContext);
String string = CopyPasteManager.getInstance().getContents(DataFlavor.stringFlavor);
if (StringUtil.isNotEmpty(string)) {
BrowserUtil.browse("http://www.google.com/search?q=" + URLEncoder.encode(string));
}
}
示例7: update
import com.intellij.ide.CopyProvider; //导入依赖的package包/类
public void update(AnActionEvent event) {
Presentation presentation = event.getPresentation();
DataContext dataContext = event.getDataContext();
CopyProvider provider = PlatformDataKeys.COPY_PROVIDER.getData(dataContext);
boolean available = provider != null && provider.isCopyEnabled(dataContext) && provider.isCopyVisible(dataContext);
presentation.setEnabled(available);
presentation.setVisible(available);
}
示例8: actionPerformed
import com.intellij.ide.CopyProvider; //导入依赖的package包/类
public void actionPerformed(AnActionEvent e) {
DataContext dataContext = e.getDataContext();
CopyProvider provider = PlatformDataKeys.COPY_PROVIDER.getData(dataContext);
if (provider == null) {
return;
}
provider.performCopy(dataContext);
}
示例9: update
import com.intellij.ide.CopyProvider; //导入依赖的package包/类
public void update(AnActionEvent event) {
Presentation presentation = event.getPresentation();
DataContext dataContext = event.getDataContext();
CopyProvider provider = PlatformDataKeys.COPY_PROVIDER.getData(dataContext);
presentation.setEnabled(provider != null && provider.isCopyEnabled(dataContext));
if (event.getPlace().equals(ActionPlaces.EDITOR_POPUP) && provider != null) {
presentation.setVisible(provider.isCopyVisible(dataContext));
}
else {
presentation.setVisible(true);
}
}
示例10: actionPerformed
import com.intellij.ide.CopyProvider; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent anActionEvent) {
DataContext ctx = anActionEvent.getDataContext();
Route[] routes = (Route[])PlatformDataKeys.SELECTED_ITEMS.getData(ctx);
CopyProvider provider = new RoutesCopyProvider(routes) {
@Override
public String getCopyValue(Route route) {
return getRouteValue(route);
}
};
provider.performCopy(ctx);
}
示例11: update
import com.intellij.ide.CopyProvider; //导入依赖的package包/类
public void update(AnActionEvent event) {
Presentation presentation = event.getPresentation();
DataContext dataContext = event.getDataContext();
CopyProvider provider = event.getData(PlatformDataKeys.COPY_PROVIDER);
boolean available = provider != null && provider.isCopyEnabled(dataContext) && provider.isCopyVisible(dataContext);
presentation.setEnabled(available);
presentation.setVisible(available);
}
示例12: actionPerformed
import com.intellij.ide.CopyProvider; //导入依赖的package包/类
public void actionPerformed(AnActionEvent e) {
DataContext dataContext = e.getDataContext();
CopyProvider provider = e.getData(PlatformDataKeys.COPY_PROVIDER);
if (provider == null) {
return;
}
provider.performCopy(dataContext);
}
示例13: update
import com.intellij.ide.CopyProvider; //导入依赖的package包/类
public void update(AnActionEvent event) {
Presentation presentation = event.getPresentation();
DataContext dataContext = event.getDataContext();
CopyProvider provider = event.getData(PlatformDataKeys.COPY_PROVIDER);
presentation.setEnabled(provider != null && provider.isCopyEnabled(dataContext));
if (event.getPlace().equals(ActionPlaces.EDITOR_POPUP) && provider != null) {
presentation.setVisible(provider.isCopyVisible(dataContext));
}
else {
presentation.setVisible(true);
}
}
示例14: getData
import com.intellij.ide.CopyProvider; //导入依赖的package包/类
@Override
public CopyProvider getData(@Nonnull DataProvider dataProvider) {
final Editor editor = dataProvider.getDataUnchecked(PlatformDataKeys.EDITOR);
if (editor instanceof EditorEx) {
return ((EditorEx) editor).getCopyProvider();
}
return null;
}
示例15: getCopyProvider
import com.intellij.ide.CopyProvider; //导入依赖的package包/类
@Override
public CopyProvider getCopyProvider() {
return myDelegate.getCopyProvider();
}