• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java IDEResourceInfoUtils类的典型用法和代码示例

java 2次浏览

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

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

示例1: checkLocationDeleted

点赞 3

import org.eclipse.ui.internal.ide.dialogs.IDEResourceInfoUtils; //导入依赖的package包/类
void checkLocationDeleted(final IProject project) throws CoreException {
	if (!project.exists()) { return; }
	final IFileInfo location = IDEResourceInfoUtils.getFileInfo(project.getLocationURI());
	if (!location.exists()) {
		final String message = NLS.bind(IDEWorkbenchMessages.RefreshAction_locationDeletedMessage,
				project.getName(), location.toString());

		final MessageDialog dialog = new MessageDialog(WorkbenchHelper.getShell(),
				IDEWorkbenchMessages.RefreshAction_dialogTitle, null, message, MessageDialog.QUESTION,
				new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0) {
			@Override
			protected int getShellStyle() {
				return super.getShellStyle() | SWT.SHEET;
			}
		};
		WorkbenchHelper.run(() -> dialog.open());

		// Do the deletion back in the operation thread
		if (dialog.getReturnCode() == 0) { // yes was chosen
			project.delete(true, true, null);
		}
	}
}
 

开发者ID:gama-platform,
项目名称:gama,
代码行数:24,
代码来源:RefreshHandler.java

示例2: checkLocationDeleted

点赞 3

import org.eclipse.ui.internal.ide.dialogs.IDEResourceInfoUtils; //导入依赖的package包/类
/**
 * Checks whether the given project's location has been deleted. If so, prompts the user with whether to delete the
 * project or not.
 */
void checkLocationDeleted(final IProject project) throws CoreException {
	if (!project.exists()) { return; }
	final IFileInfo location = IDEResourceInfoUtils.getFileInfo(project.getLocationURI());
	if (!location.exists()) {
		final String message = NLS.bind(IDEWorkbenchMessages.RefreshAction_locationDeletedMessage,
				project.getName(), location.toString());

		final MessageDialog dialog = new MessageDialog(WorkbenchHelper.getShell(),
				IDEWorkbenchMessages.RefreshAction_dialogTitle, null, message, MessageDialog.QUESTION,
				new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0) {
			@Override
			protected int getShellStyle() {
				return super.getShellStyle() | SWT.SHEET;
			}
		};
		WorkbenchHelper.run(() -> dialog.open());

		// Do the deletion back in the operation thread
		if (dialog.getReturnCode() == 0) { // yes was chosen
			project.delete(true, true, null);
		}
	}
}
 

开发者ID:gama-platform,
项目名称:gama,
代码行数:28,
代码来源:RefreshAction.java

示例3: validate

点赞 3

import org.eclipse.ui.internal.ide.dialogs.IDEResourceInfoUtils; //导入依赖的package包/类
public IStatus validate(Object[] selection) {
	int nSelected = selection.length;
	String pluginId = IDEWorkbenchPlugin.IDE_WORKBENCH;

	if (nSelected == 0 || (nSelected > 1 && multiSelect == false)) {
		return new Status(IStatus.ERROR, pluginId, IStatus.ERROR,
				IDEResourceInfoUtils.EMPTY_STRING, null);
	}
	for (int i = 0; i < selection.length; i++) {
		Object curr = selection[i];
		if (curr instanceof IFileStore) {
			IFileStore file = (IFileStore) curr;
			if (acceptFolders == false
					&& file.fetchInfo().isDirectory()) {
				return new Status(IStatus.ERROR, pluginId,
						IStatus.ERROR,
						IDEResourceInfoUtils.EMPTY_STRING, null);
			}

		}
	}
	return Status.OK_STATUS;
}
 

开发者ID:heartsome,
项目名称:translationstudio8,
代码行数:24,
代码来源:FileFolderSelectionDialog.java

示例4: getChildren

点赞 2

import org.eclipse.ui.internal.ide.dialogs.IDEResourceInfoUtils; //导入依赖的package包/类
public Object[] getChildren(Object parentElement) {
	if (parentElement instanceof IFileStore) {
		IFileStore[] children = IDEResourceInfoUtils.listFileStores(
				(IFileStore) parentElement, fileFilter,
				new NullProgressMonitor());
		if (children != null) {
			return children;
		}
	}
	return EMPTY;
}
 

开发者ID:heartsome,
项目名称:translationstudio8,
代码行数:12,
代码来源:FileFolderSelectionDialog.java

示例5: checkExist

点赞 2

import org.eclipse.ui.internal.ide.dialogs.IDEResourceInfoUtils; //导入依赖的package包/类
/**
 * Checks whether the resources with the given names exist.
 *
 * @param resources
 *            IResources to checl
 * @return Multi status with one error message for each missing file.
 */
IStatus checkExist(IResource[] resources) {
    MultiStatus multiStatus = new MultiStatus(PlatformUI.PLUGIN_ID, IStatus.OK, getProblemsMessage(), null);

    for (int i = 0; i < resources.length; i++) {
        IResource resource = resources[i];
        if (resource != null) {
            URI location = resource.getLocationURI();
            String message = null;
            if (location != null) {
                IFileInfo info = IDEResourceInfoUtils.getFileInfo(location);
                if (info == null || info.exists() == false) {
                    if (resource.isLinked()) {
                        message = NLS.bind(IDEWorkbenchMessages.CopyFilesAndFoldersOperation_missingLinkTarget,
                                resource.getName());
                    } else {
                        message = NLS.bind(IDEWorkbenchMessages.CopyFilesAndFoldersOperation_resourceDeleted,
                                resource.getName());
                    }
                }
            }
            if (message != null) {
                IStatus status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.OK, message, null);
                multiStatus.add(status);
            }
        }
    }
    return multiStatus;
}
 

开发者ID:fabioz,
项目名称:Pydev,
代码行数:36,
代码来源:CopyFilesAndFoldersOperation.java

示例6: buildFileStores

点赞 2

import org.eclipse.ui.internal.ide.dialogs.IDEResourceInfoUtils; //导入依赖的package包/类
/**
 * Build the collection of fileStores that map to fileNames. If any of them
 * cannot be found then match then return null.
 *
 * @param fileNames
 * @return IFileStore[]
 */
private IFileStore[] buildFileStores(final String[] fileNames) {
    IFileStore[] stores = new IFileStore[fileNames.length];
    for (int i = 0; i < fileNames.length; i++) {
        IFileStore store = IDEResourceInfoUtils.getFileStore(fileNames[i]);
        if (store == null) {
            reportFileInfoNotFound(fileNames[i]);
            return null;
        }
        stores[i] = store;
    }
    return stores;
}
 

开发者ID:fabioz,
项目名称:Pydev,
代码行数:20,
代码来源:CopyFilesAndFoldersOperation.java

示例7: validateImportDestination

点赞 2

import org.eclipse.ui.internal.ide.dialogs.IDEResourceInfoUtils; //导入依赖的package包/类
/**
 * Checks whether the destination is valid for copying the source files.
 * <p>
 * Note this method is for internal use only. It is not API.
 * </p>
 *
 * @param destination
 *            the destination container
 * @param sourceNames
 *            the source file names
 * @return an error message, or <code>null</code> if the path is valid
 */
public String validateImportDestination(IContainer destination, String[] sourceNames) {

    IFileStore[] stores = new IFileStore[sourceNames.length];
    for (int i = 0; i < sourceNames.length; i++) {
        IFileStore store = IDEResourceInfoUtils.getFileStore(sourceNames[i]);
        if (store == null) {
            return NLS.bind(IDEWorkbenchMessages.CopyFilesAndFoldersOperation_infoNotFound, sourceNames[i]);
        }
        stores[i] = store;
    }
    return validateImportDestinationInternal(destination, stores);

}
 

开发者ID:fabioz,
项目名称:Pydev,
代码行数:26,
代码来源:CopyFilesAndFoldersOperation.java

示例8: createUserEntryArea

点赞 2

import org.eclipse.ui.internal.ide.dialogs.IDEResourceInfoUtils; //导入依赖的package包/类
/**
 * Create the area for user entry.
 * 
 * @param composite
 * @param defaultEnabled
 */
private void createUserEntryArea(Composite composite, boolean defaultEnabled)
{
	// location label
	locationLabel = new Label(composite, SWT.NONE);
	locationLabel.setText(IDEWorkbenchMessages.ProjectLocationSelectionDialog_locationLabel);

	// project location entry field
	locationPathField = new Text(composite, SWT.BORDER);
	GridData data = new GridData(GridData.FILL_HORIZONTAL);
	data.widthHint = SIZING_TEXT_FIELD_WIDTH;
	data.horizontalSpan = 2;
	locationPathField.setLayoutData(data);

	// browse button
	browseButton = new Button(composite, SWT.PUSH);
	browseButton.setText(BROWSE_LABEL);
	browseButton.addSelectionListener(new SelectionAdapter()
	{
		public void widgetSelected(SelectionEvent event)
		{
			handleLocationBrowseButtonPressed();
		}
	});

	createFileSystemSelection(composite);

	if (defaultEnabled)
	{
		locationPathField.setText(TextProcessor.process(getDefaultPathDisplayString()));
	}
	else
	{
		if (existingProject == null)
		{
			locationPathField.setText(IDEResourceInfoUtils.EMPTY_STRING);
		}
		else
		{
			locationPathField.setText(TextProcessor.process(existingProject.getLocation().toOSString()));
		}
	}

	locationPathField.addModifyListener(new ModifyListener()
	{
		/*
		 * (non-Javadoc)
		 * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
		 */
		public void modifyText(ModifyEvent e)
		{
			errorReporter.reportError(checkValidLocation(), false);
		}
	});
}
 

开发者ID:apicloudcom,
项目名称:APICloud-Studio,
代码行数:61,
代码来源:ProjectContentsLocationArea.java

示例9: handleLocationBrowseButtonPressed

点赞 2

import org.eclipse.ui.internal.ide.dialogs.IDEResourceInfoUtils; //导入依赖的package包/类
/**
 * Open an appropriate directory browser
 */
private void handleLocationBrowseButtonPressed()
{

	String selectedDirectory = null;
	String dirName = getPathFromLocationField();

	if (!dirName.equals(IDEResourceInfoUtils.EMPTY_STRING))
	{
		IFileInfo info;
		info = IDEResourceInfoUtils.getFileInfo(dirName);

		if (info == null || !(info.exists()))
			dirName = IDEResourceInfoUtils.EMPTY_STRING;
	}
	else
	{
		String value = getDialogSettings().get(SAVED_LOCATION_ATTR);
		if (value != null)
		{
			dirName = value;
		}
	}

	FileSystemConfiguration config = getSelectedConfiguration();
	if (config == null || config.equals(FileSystemSupportRegistry.getInstance().getDefaultConfiguration()))
	{
		DirectoryDialog dialog = new DirectoryDialog(locationPathField.getShell(), SWT.SHEET);
		dialog.setMessage(IDEWorkbenchMessages.ProjectLocationSelectionDialog_directoryLabel);

		dialog.setFilterPath(dirName);

		selectedDirectory = dialog.open();

	}
	else
	{
		URI uri = getSelectedConfiguration().getContributor().browseFileSystem(dirName, browseButton.getShell());
		if (uri != null)
			selectedDirectory = uri.toString();
	}

	if (selectedDirectory != null)
	{
		updateLocationField(selectedDirectory);
		getDialogSettings().put(SAVED_LOCATION_ATTR, selectedDirectory);
	}
}
 

开发者ID:apicloudcom,
项目名称:APICloud-Studio,
代码行数:51,
代码来源:ProjectContentsLocationArea.java

示例10: checkOverwrite

点赞 2

import org.eclipse.ui.internal.ide.dialogs.IDEResourceInfoUtils; //导入依赖的package包/类
/**
 * Check if the user wishes to overwrite the supplied resource or all
 * resources.
 *
 * @param source
 *            the source resource
 * @param destination
 *            the resource to be overwritten
 * @return one of IDialogConstants.YES_ID, IDialogConstants.YES_TO_ALL_ID,
 *         IDialogConstants.NO_ID, IDialogConstants.CANCEL_ID indicating
 *         whether the current resource or all resources can be overwritten,
 *         or if the operation should be canceled.
 */
private int checkOverwrite(final IResource source, final IResource destination) {
    final int[] result = new int[1];

    // Dialogs need to be created and opened in the UI thread
    Runnable query = new Runnable() {
        @Override
        public void run() {
            String message;
            int resultId[] = { IDialogConstants.YES_ID, IDialogConstants.YES_TO_ALL_ID, IDialogConstants.NO_ID,
                    IDialogConstants.CANCEL_ID };
            String labels[] = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL,
                    IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL };

            if (destination.getType() == IResource.FOLDER) {
                if (homogenousResources(source, destination)) {
                    message = NLS.bind(IDEWorkbenchMessages.CopyFilesAndFoldersOperation_overwriteMergeQuestion,
                            destination.getFullPath().makeRelative());
                } else {
                    if (destination.isLinked()) {
                        message = NLS.bind(
                                IDEWorkbenchMessages.CopyFilesAndFoldersOperation_overwriteNoMergeLinkQuestion,
                                destination.getFullPath().makeRelative());
                    } else {
                        message = NLS.bind(
                                IDEWorkbenchMessages.CopyFilesAndFoldersOperation_overwriteNoMergeNoLinkQuestion,
                                destination.getFullPath().makeRelative());
                    }
                    resultId = new int[] { IDialogConstants.YES_ID, IDialogConstants.NO_ID,
                            IDialogConstants.CANCEL_ID };
                    labels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL,
                            IDialogConstants.CANCEL_LABEL };
                }
            } else {
                String[] bindings = new String[] { IDEResourceInfoUtils.getLocationText(destination),
                        IDEResourceInfoUtils.getDateStringValue(destination),
                        IDEResourceInfoUtils.getLocationText(source),
                        IDEResourceInfoUtils.getDateStringValue(source) };
                message = NLS.bind(IDEWorkbenchMessages.CopyFilesAndFoldersOperation_overwriteWithDetailsQuestion,
                        bindings);
            }
            MessageDialog dialog = new MessageDialog(messageShell,
                    IDEWorkbenchMessages.CopyFilesAndFoldersOperation_resourceExists, null, message,
                    MessageDialog.QUESTION, labels, 0);
            dialog.open();
            if (dialog.getReturnCode() == SWT.DEFAULT) {
                // A window close returns SWT.DEFAULT, which has to be
                // mapped to a cancel
                result[0] = IDialogConstants.CANCEL_ID;
            } else {
                result[0] = resultId[dialog.getReturnCode()];
            }
        }
    };
    messageShell.getDisplay().syncExec(query);
    return result[0];
}
 

开发者ID:fabioz,
项目名称:Pydev,
代码行数:70,
代码来源:CopyFilesAndFoldersOperation.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)