本文整理汇总了Java中org.eclipse.che.ide.api.app.AppContext.getResources方法的典型用法代码示例。如果您正苦于以下问题:Java AppContext.getResources方法的具体用法?Java AppContext.getResources怎么用?Java AppContext.getResources使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.che.ide.api.app.AppContext
的用法示例。
在下文中一共展示了AppContext.getResources方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isCutEnable
import org.eclipse.che.ide.api.app.AppContext; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public boolean isCutEnable(AppContext appContext) {
final Resource[] resources = appContext.getResources();
// check general state
if (resources == null || resources.length == 0) {
return false;
}
for (Resource resource : resources) {
// if there is at least one root project
if (resource.getResourceType() == PROJECT && resource.getLocation().segmentCount() == 1) {
return false;
}
}
return true;
}
示例2: performCut
import org.eclipse.che.ide.api.app.AppContext; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public void performCut(AppContext appContext) {
final Resource[] resources = appContext.getResources();
// check general state
checkState(resources != null && resources.length > 0);
for (Resource resource : resources) {
// if there is at least one root project
if (resource.getResourceType() == PROJECT && resource.getLocation().segmentCount() == 1) {
throw new IllegalStateException(
"Project '" + resource.getLocation() + "' can not be cut");
}
}
copyPasteManager.setResources(resources, true);
}
示例3: isPastePossible
import org.eclipse.che.ide.api.app.AppContext; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public boolean isPastePossible(AppContext appContext) {
final Resource[] resources = appContext.getResources();
// check general state
if (resources == null || resources.length > 1) {
return false;
}
final Resource destination = resources[0];
// destination should be a container type
if (destination instanceof Container) {
return true;
}
final Resource[] items = copyPasteManager.getResources();
// check prepared items
if (items == null || items.length == 0) {
return false;
}
return false;
}
示例4: performPaste
import org.eclipse.che.ide.api.app.AppContext; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public void performPaste(AppContext appContext) {
final Resource[] resources = appContext.getResources();
// check general state
checkState(resources != null && resources.length == 1 && resources[0] instanceof Container);
final Resource[] items = copyPasteManager.getResources();
// check prepared items
if (items == null || items.length == 0) {
throw new IllegalStateException("Nothing to process");
}
copyPasteManager.paste(resources[0].getLocation());
}
示例5: isCopyEnable
import org.eclipse.che.ide.api.app.AppContext; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public boolean isCopyEnable(AppContext appContext) {
final Resource[] resources = appContext.getResources();
// check general state
return !(resources == null || resources.length == 0);
}
示例6: performCopy
import org.eclipse.che.ide.api.app.AppContext; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public void performCopy(AppContext appContext) {
final Resource[] resources = appContext.getResources();
// check general state
checkState(resources != null && resources.length > 0);
copyPasteManager.setResources(resources, false);
}