本文整理汇总了Java中org.eclipse.ui.internal.navigator.resources.plugin.WorkbenchNavigatorMessages类的典型用法代码示例。如果您正苦于以下问题:Java WorkbenchNavigatorMessages类的具体用法?Java WorkbenchNavigatorMessages怎么用?Java WorkbenchNavigatorMessages使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WorkbenchNavigatorMessages类属于org.eclipse.ui.internal.navigator.resources.plugin包,在下文中一共展示了WorkbenchNavigatorMessages类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: performFileDrop
import org.eclipse.ui.internal.navigator.resources.plugin.WorkbenchNavigatorMessages; //导入依赖的package包/类
/**
* Performs a drop using the FileTransfer transfer type.
*/
private IStatus performFileDrop(final CommonDropAdapter anAdapter, final Object data) {
final int currentOperation = anAdapter.getCurrentOperation();
final MultiStatus problems =
new MultiStatus(PlatformUI.PLUGIN_ID, 0, WorkbenchNavigatorMessages.DropAdapter_problemImporting, null);
mergeStatus(problems,
validateTarget(anAdapter.getCurrentTarget(), anAdapter.getCurrentTransfer(), currentOperation));
final IContainer target = getActualTarget(ResourceManager.getResource(anAdapter.getCurrentTarget()));
final String[] names = (String[]) data;
// Run the import operation asynchronously.
// Otherwise the drag source (e.g., Windows Explorer) will be blocked
// while the operation executes. Fixes bug 16478.
Display.getCurrent().asyncExec(() -> {
getShell().forceActive();
new CopyFilesAndFoldersOperation(getShell()).copyOrLinkFiles(names, target, currentOperation);
});
return problems;
}
示例2: openError
import org.eclipse.ui.internal.navigator.resources.plugin.WorkbenchNavigatorMessages; //导入依赖的package包/类
/**
* Opens an error dialog if necessary. Takes care of complex rules necessary for making the error dialog look nice.
*/
private void openError(final IStatus status) {
if (status == null) { return; }
final String genericTitle = WorkbenchNavigatorMessages.DropAdapter_title;
final int codes = IStatus.ERROR | IStatus.WARNING;
// simple case: one error, not a multistatus
if (!status.isMultiStatus()) {
ErrorDialog.openError(getShell(), genericTitle, null, status, codes);
return;
}
// one error, single child of multistatus
final IStatus[] children = status.getChildren();
if (children.length == 1) {
ErrorDialog.openError(getShell(), status.getMessage(), null, children[0], codes);
return;
}
// several problems
ErrorDialog.openError(getShell(), genericTitle, null, status, codes);
}
示例3: openError
import org.eclipse.ui.internal.navigator.resources.plugin.WorkbenchNavigatorMessages; //导入依赖的package包/类
/**
* Opens an error dialog if necessary. Takes care of complex rules necessary for making the error dialog look nice.
*
* @param status
* the status
*/
private void openError(IStatus status) {
if (status == null) {
return;
}
String genericTitle = WorkbenchNavigatorMessages.DropAdapter_title;
int codes = IStatus.ERROR | IStatus.WARNING;
// simple case: one error, not a multistatus
if (!status.isMultiStatus()) {
ErrorDialog.openError(getShell(), genericTitle, null, status, codes);
return;
}
// one error, single child of multistatus
IStatus[] children = status.getChildren();
if (children.length == 1) {
ErrorDialog.openError(getShell(), status.getMessage(), null, children[0], codes);
return;
}
// several problems
ErrorDialog.openError(getShell(), genericTitle, null, status, codes);
}
示例4: performFileDrop
import org.eclipse.ui.internal.navigator.resources.plugin.WorkbenchNavigatorMessages; //导入依赖的package包/类
/**
* Performs a drop using the FileTransfer transfer type.
*
* @param anAdapter
* the an adapter
* @param data
* the data
* @return the i status
*/
private IStatus performFileDrop(CommonDropAdapter anAdapter, Object data) {
MultiStatus problems = new MultiStatus(PlatformUI.PLUGIN_ID, 0, WorkbenchNavigatorMessages.DropAdapter_problemImporting, null);
mergeStatus(problems, validateTarget(anAdapter.getCurrentTarget(), anAdapter.getCurrentTransfer(), anAdapter.getCurrentOperation()));
final IContainer target = getActualTarget(((MediaRootNode) anAdapter.getCurrentTarget()).getResource());
final String[] names = (String[]) data;
// Run the import operation asynchronously.
// Otherwise the drag source (e.g., Windows Explorer) will be blocked
// while the operation executes. Fixes bug 16478.
Display.getCurrent().asyncExec(new Runnable() {
public void run() {
getShell().forceActive();
CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation(getShell());
operation.copyFiles(names, target);
}
});
return problems;
}
示例5: performResourceCopy
import org.eclipse.ui.internal.navigator.resources.plugin.WorkbenchNavigatorMessages; //导入依赖的package包/类
/**
* Performs a resource copy
*/
private IStatus performResourceCopy(CommonDropAdapter dropAdapter, Shell shell, IResource[] sources) {
MultiStatus problems = new MultiStatus(PlatformUI.PLUGIN_ID, 1,
WorkbenchNavigatorMessages.DropAdapter_problemsMoving, null);
mergeStatus(
problems,
validateTarget(getCurrentTarget(dropAdapter), dropAdapter.getCurrentTransfer(),
dropAdapter.getCurrentOperation()));
IContainer target = getActualTarget((IResource) getCurrentTarget(dropAdapter));
CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation(shell);
IResource[] copiedResources = operation.copyResources(sources, target);
if (copiedResources.length > 0) {
PythonPathHelper.updatePyPath(copiedResources, target, PythonPathHelper.OPERATION_COPY);
}
return problems;
}
示例6: performFileDrop
import org.eclipse.ui.internal.navigator.resources.plugin.WorkbenchNavigatorMessages; //导入依赖的package包/类
/**
* Performs a drop using the FileTransfer transfer type.
*/
private IStatus performFileDrop(CommonDropAdapter anAdapter, Object data) {
data = getActual(data);
MultiStatus problems = new MultiStatus(PlatformUI.PLUGIN_ID, 0,
WorkbenchNavigatorMessages.DropAdapter_problemImporting, null);
mergeStatus(
problems,
validateTarget(getCurrentTarget(anAdapter), anAdapter.getCurrentTransfer(),
anAdapter.getCurrentOperation()));
final IContainer target = getActualTarget((IResource) getCurrentTarget(anAdapter));
final String[] names = (String[]) data;
// Run the import operation asynchronously.
// Otherwise the drag source (e.g., Windows Explorer) will be blocked
// while the operation executes. Fixes bug 16478.
Display.getCurrent().asyncExec(new Runnable() {
@Override
public void run() {
getShell().forceActive();
CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation(getShell());
operation.copyFiles(names, target);
}
});
return problems;
}
示例7: openError
import org.eclipse.ui.internal.navigator.resources.plugin.WorkbenchNavigatorMessages; //导入依赖的package包/类
/**
* Opens an error dialog if necessary. Takes care of complex rules necessary
* for making the error dialog look nice.
*/
private void openError(IStatus status) {
if (status == null) {
return;
}
String genericTitle = WorkbenchNavigatorMessages.DropAdapter_title;
int codes = IStatus.ERROR | IStatus.WARNING;
// simple case: one error, not a multistatus
if (!status.isMultiStatus()) {
ErrorDialog.openError(getShell(), genericTitle, null, status, codes);
return;
}
// one error, single child of multistatus
IStatus[] children = status.getChildren();
if (children.length == 1) {
ErrorDialog.openError(getShell(), status.getMessage(), null, children[0], codes);
return;
}
// several problems
ErrorDialog.openError(getShell(), genericTitle, null, status, codes);
}
示例8: PasteAction
import org.eclipse.ui.internal.navigator.resources.plugin.WorkbenchNavigatorMessages; //导入依赖的package包/类
/**
* Creates a new action.
*
* @param shell
* the shell for any dialogs
* @param clipboard
* the clipboard
*/
public PasteAction(final Shell shell, final Clipboard clipboard) {
super(WorkbenchNavigatorMessages.PasteAction_Past_);
this.shell = shell;
this.clipboard = clipboard;
setToolTipText(WorkbenchNavigatorMessages.PasteAction_Paste_selected_resource_s_);
setId(PasteAction.ID);
PlatformUI.getWorkbench().getHelpSystem().setHelp(this, "HelpId"); //$NON-NLS-1$
// TODO INavigatorHelpContextIds.PASTE_ACTION);
}
示例9: CopyAction
import org.eclipse.ui.internal.navigator.resources.plugin.WorkbenchNavigatorMessages; //导入依赖的package包/类
/**
* Creates a new action.
*
* @param shell
* the shell for any dialogs
* @param clipboard
* a platform clipboard
*/
public CopyAction(final Shell shell, final Clipboard clipboard) {
super(WorkbenchNavigatorMessages.CopyAction_Cop_);
Assert.isNotNull(shell);
Assert.isNotNull(clipboard);
this.shell = shell;
this.clipboard = clipboard;
setToolTipText(WorkbenchNavigatorMessages.CopyAction_Copy_selected_resource_s_);
setId(CopyAction.ID);
PlatformUI.getWorkbench().getHelpSystem().setHelp(this, "CopyHelpId"); //$NON-NLS-1$
// TODO INavigatorHelpContextIds.COPY_ACTION);
}
示例10: addOpenWithMenu
import org.eclipse.ui.internal.navigator.resources.plugin.WorkbenchNavigatorMessages; //导入依赖的package包/类
private void addOpenWithMenu(final IMenuManager aMenu) {
final IStructuredSelection ss = (IStructuredSelection) getContext().getSelection();
if (ss == null || ss.size() != 1) { return; }
final Object o = ss.getFirstElement();
// first try IResource
IAdaptable openable = (IAdaptable) AdaptabilityUtility.getAdapter(o, IResource.class);
// otherwise try ResourceMapping
if (openable == null) {
openable = (IAdaptable) AdaptabilityUtility.getAdapter(o, ResourceMapping.class);
} else if (((IResource) openable).getType() != IResource.FILE) {
openable = null;
}
if (openable != null) {
// Create a menu flyout.
final IMenuManager submenu =
new MenuManager(WorkbenchNavigatorMessages.OpenActionProvider_OpenWithMenu_label,
ICommonMenuConstants.GROUP_OPEN_WITH);
submenu.add(new GroupMarker(ICommonMenuConstants.GROUP_TOP));
submenu.add(new OpenWithMenu(viewSite.getPage(), openable));
submenu.add(new GroupMarker(ICommonMenuConstants.GROUP_ADDITIONS));
// Add the submenu.
if (submenu.getItems().length > 2 && submenu.isEnabled()) {
aMenu.appendToGroup(ICommonMenuConstants.GROUP_OPEN_WITH, submenu);
}
}
}
示例11: validateTarget
import org.eclipse.ui.internal.navigator.resources.plugin.WorkbenchNavigatorMessages; //导入依赖的package包/类
/**
* Ensures that the drop target meets certain criteria.
*
* @param target
* the target
* @param transferType
* the transfer type
* @param dropOperation
* the drop operation
* @return the i status
*/
private IStatus validateTarget(Object target, TransferData transferType, int dropOperation) {
if (!(target instanceof IResource)) {
return WorkbenchNavigatorPlugin.createInfoStatus(WorkbenchNavigatorMessages.DropAdapter_targetMustBeResource);
}
IResource resource = (IResource) target;
if (!resource.isAccessible()) {
return WorkbenchNavigatorPlugin.createErrorStatus(WorkbenchNavigatorMessages.DropAdapter_canNotDropIntoClosedProject);
}
IContainer destination = getActualTarget(resource);
if (destination.getType() == IResource.ROOT) {
return WorkbenchNavigatorPlugin.createErrorStatus(WorkbenchNavigatorMessages.DropAdapter_resourcesCanNotBeSiblings);
}
String message = null;
if (FileTransfer.getInstance().isSupportedType(transferType)) {
String[] sourceNames = (String[]) FileTransfer.getInstance().nativeToJava(transferType);
if (sourceNames == null) {
// source names will be null on Linux. Use empty names to do
// destination validation.
// Fixes bug 29778
sourceNames = new String[0];
}
CopyFilesAndFoldersOperation copyOperation = new CopyFilesAndFoldersOperation(getShell());
message = copyOperation.validateImportDestination(destination, sourceNames);
}
if (message != null) {
return WorkbenchNavigatorPlugin.createErrorStatus(message);
}
return Status.OK_STATUS;
}
示例12: performResourceCopy
import org.eclipse.ui.internal.navigator.resources.plugin.WorkbenchNavigatorMessages; //导入依赖的package包/类
/**
* Performs a resource copy
*/
private IStatus performResourceCopy(final CommonDropAdapter dropAdapter, final Shell shell,
final IResource[] sources) {
final MultiStatus problems =
new MultiStatus(PlatformUI.PLUGIN_ID, 1, WorkbenchNavigatorMessages.DropAdapter_problemsMoving, null);
mergeStatus(problems, validateTarget(dropAdapter.getCurrentTarget(), dropAdapter.getCurrentTransfer(),
dropAdapter.getCurrentOperation()));
final IContainer target = getActualTarget(ResourceManager.getResource(dropAdapter.getCurrentTarget()));
boolean shouldLinkAutomatically = false;
if (target.isVirtual()) {
shouldLinkAutomatically = true;
for (int i = 0; i < sources.length; i++) {
if (sources[i].getType() != IResource.FILE && sources[i].getLocation() != null) {
// If the source is a folder, but the location is null (a
// broken link, for example),
// we still generate a link automatically (the best option).
shouldLinkAutomatically = false;
break;
}
}
}
final CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation(shell);
// if the target is a virtual folder and all sources are files, then
// automatically create links
if (shouldLinkAutomatically) {
operation.setCreateLinks(true);
operation.copyResources(sources, target);
} else {
boolean allSourceAreLinksOrVirtualFolders = true;
for (int i = 0; i < sources.length; i++) {
if (!sources[i].isVirtual() && !sources[i].isLinked()) {
allSourceAreLinksOrVirtualFolders = false;
break;
}
}
// if all sources are either links or groups, copy then normally,
// don't show the dialog
if (!allSourceAreLinksOrVirtualFolders) {
final IPreferenceStore store = IDEWorkbenchPlugin.getDefault().getPreferenceStore();
final String dndPreference = store.getString(
target.isVirtual() ? IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_VIRTUAL_FOLDER_MODE
: IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_MODE);
if (dndPreference.equals(IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_MODE_PROMPT)) {
final ImportTypeDialog dialog =
new ImportTypeDialog(getShell(), dropAdapter.getCurrentOperation(), sources, target);
dialog.setResource(target);
if (dialog.open() == Window.OK) {
if (dialog.getSelection() == ImportTypeDialog.IMPORT_VIRTUAL_FOLDERS_AND_LINKS)
operation.setVirtualFolders(true);
if (dialog.getSelection() == ImportTypeDialog.IMPORT_LINK)
operation.setCreateLinks(true);
if (dialog.getVariable() != null)
operation.setRelativeVariable(dialog.getVariable());
operation.copyResources(sources, target);
} else
return problems;
} else
operation.copyResources(sources, target);
} else
operation.copyResources(sources, target);
}
return problems;
}