• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ResourceComparator类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: chooseWorkspace

import org.eclipse.ui.views.navigator.ResourceComparator; //导入依赖的package包/类
protected void chooseWorkspace ()
{
    final ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog ( getShell (), new WorkbenchLabelProvider (), new WorkbenchContentProvider () );
    dialog.setTitle ( "Select driver exporter configuration file" );
    dialog.setMessage ( "Choose a driver exporter file for the configuration" );
    dialog.setInput ( ResourcesPlugin.getWorkspace ().getRoot () );
    dialog.setComparator ( new ResourceComparator ( ResourceComparator.NAME ) );
    dialog.setAllowMultiple ( true );
    dialog.setDialogBoundsSettings ( getDialogBoundsSettings ( HiveTab.WORKSPACE_SELECTION_DIALOG ), Dialog.DIALOG_PERSISTSIZE );
    if ( dialog.open () == IDialogConstants.OK_ID )
    {
        final IResource resource = (IResource)dialog.getFirstResult ();
        if ( resource != null )
        {
            final String arg = resource.getFullPath ().toString ();
            final String fileLoc = VariablesPlugin.getDefault ().getStringVariableManager ().generateVariableExpression ( "workspace_loc", arg ); //$NON-NLS-1$
            this.fileText.setText ( fileLoc );
            makeDirty ();
        }
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:22,代码来源:HiveTab.java


示例2: ResourceTreeSelectionDialog

import org.eclipse.ui.views.navigator.ResourceComparator; //导入依赖的package包/类
/**
 * Constructs an instance of <code>ResourceTreeSelectionDialog</code>.
 * 
 * @param parent the parent shell for the dialog
 * @param title dialog title
 * @param message dialog message
 * @param rootResource resource that serves as the root of the tree. This
 *          resource's descendants are visible in the tree, but the root
 *          itself is not.
 * @param initialResource the initially-selected resource
 * @param visibleResourceTypes a set of {@link IResource} types that are
 *          visible in the tree (e.g.
 *          <code>IResource.FILE | IResource.FOLDER</code>)
 * @param acceptedResourceTypes a set of {@link IResource} types that can be
 *          selected
 * @param multiSelection whether or not to allow selection of multiple
 *          resources
 */
public ResourceTreeSelectionDialog(Shell parent, String title,
    String message, IContainer rootResource, IResource initialResource,
    int visibleResourceTypes, int acceptedResourceTypes,
    boolean multiSelection) {
  super(parent, new WorkbenchLabelProvider(), new WorkbenchContentProvider());

  setTitle(title);
  setMessage(message);
  setHelpAvailable(false);

  setInput(rootResource);
  if (initialResource != null) {
    setInitialSelection(initialResource);
  }
  setComparator(new ResourceComparator(ResourceComparator.NAME));
  setValidator(new ResourceFilter(acceptedResourceTypes, multiSelection));
  addFilter(new ResourceFilter(visibleResourceTypes));
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:37,代码来源:ResourceTreeSelectionDialog.java


示例3: createTreeViewer

import org.eclipse.ui.views.navigator.ResourceComparator; //导入依赖的package包/类
/**
 * Creates the tree viewer.
 *
 * @param parent the parent composite
 * @return the tree viewer
 */
protected CheckboxTreeViewer createTreeViewer(Composite parent) {
    fViewer = new CheckboxTreeViewer(parent, SWT.BORDER);

    fViewer.setContentProvider(fContentProvider);
    fViewer.setLabelProvider(fLabelProvider);
    fViewer.addCheckStateListener(new ICheckStateListener() {
        @Override
        public void checkStateChanged(CheckStateChangedEvent event) {
            updateOKStatus();
        }
    });

    fViewer.setComparator(new ResourceComparator(ResourceComparator.NAME));
    if (fFilters != null) {
        for (int i = 0; i != fFilters.size(); i++) {
            fViewer.addFilter((ViewerFilter) fFilters.get(i));
        }
    }

    fViewer.setInput(fInput);

    return fViewer;
}
 
开发者ID:iloveeclipse,项目名称:filesync4eclipse,代码行数:30,代码来源:MultipleFolderSelectionDialog.java


示例4: createTreeViewer

import org.eclipse.ui.views.navigator.ResourceComparator; //导入依赖的package包/类
/**
 * Creates the tree viewer.
 *
 * @param parent the parent composite
 * @return the tree viewer
 */
protected CheckboxTreeViewer createTreeViewer(Composite parent) {
	fViewer = new CheckboxTreeViewer(parent, SWT.BORDER);

	fViewer.setContentProvider(fContentProvider);
	fViewer.setLabelProvider(fLabelProvider);
	fViewer.addCheckStateListener(new ICheckStateListener() {
		public void checkStateChanged(CheckStateChangedEvent event) {
			updateOKStatus();
		}
	});

	fViewer.setComparator(new ResourceComparator(ResourceComparator.NAME));
	if (fFilters != null) {
		for (int i = 0; i != fFilters.size(); i++)
			fViewer.addFilter(fFilters.get(i));
	}

	fViewer.setInput(fInput);

	return fViewer;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:28,代码来源:MultipleFolderSelectionDialog.java


示例5: chooseWorkspaceDirectory

import org.eclipse.ui.views.navigator.ResourceComparator; //导入依赖的package包/类
private String chooseWorkspaceDirectory(String prompt) {
    ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(),
            new WorkbenchContentProvider());
    dialog.setTitle("Selecting directory");
    dialog.setMessage(prompt);
    dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
    dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
    if (dialog.open() == IDialogConstants.OK_ID) {
        IResource resource = (IResource)dialog.getFirstResult();
        if (resource != null) {
            String path = resource.getFullPath().toString();
            String fileLoc = VariablesPlugin.getDefault().getStringVariableManager()
                    .generateVariableExpression("workspace_loc", path);
            return fileLoc;
        }
    }
    return null;
}
 
开发者ID:konsoletyper,项目名称:teavm,代码行数:19,代码来源:TeaVMProfileDialog.java


示例6: FileSelectionDialog

import org.eclipse.ui.views.navigator.ResourceComparator; //导入依赖的package包/类
public FileSelectionDialog(Shell parent, List<IFile> files, String title,
		String message, String filterExtension, String filterMessage) {
	super(parent, new WorkbenchLabelProvider(),
			new WorkbenchContentProvider());

	setTitle(title);
	setMessage(message);
	fFilter = new FileFilter(files, filterExtension);
	fFilterMessage = filterMessage;
	setInput(ResourcesPlugin.getWorkspace().getRoot());
	setComparator(new ResourceComparator(ResourceComparator.NAME));

	ISelectionStatusValidator validator = new ISelectionStatusValidator() {
		@Override
		public IStatus validate(Object[] selection) {
			if (selection.length == 0) {
				return new Status(IStatus.ERROR,
						JSBuildFileUIPlugin.PLUGIN_ID, 0, "", null);
			}
			for (int i = 0; i < selection.length; i++) {
				if (!(selection[i] instanceof IFile)) {
					return new Status(IStatus.ERROR,
							JSBuildFileUIPlugin.PLUGIN_ID, 0, "", null);
				}
			}
			return new Status(IStatus.OK, JSBuildFileUIPlugin.PLUGIN_ID, 0,
					"", null);
		}
	};
	setValidator(validator);
}
 
开发者ID:angelozerr,项目名称:jsbuild-eclipse,代码行数:32,代码来源:FileSelectionDialog.java


示例7: handleManifestfileBrowse

import org.eclipse.ui.views.navigator.ResourceComparator; //导入依赖的package包/类
/**
 * Uses the standard container selection dialog to choose the new value for
 * the container field.
 */

private void handleManifestfileBrowse() {
	String manifestFilename = getManifestfile();

	ILabelProvider lp = new WorkbenchLabelProvider();
	ITreeContentProvider cp = new WorkbenchContentProvider();

	ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), lp, cp);
	dialog.setValidator(null);
	dialog.setAllowMultiple(false);
	dialog.setTitle("Select Manifest File"); //$NON-NLS-1$
	//        dialog.setMessage("msg?"); //$NON-NLS-1$
	// dialog.addFilter(filter);
	// dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
	dialog.setInput(jproject.getProject());
	dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));

	if (dialog.open() == ElementTreeSelectionDialog.OK) {
		Object[] elements = dialog.getResult();
		if (elements.length == 1) {
			manifestFilename = ((IResource) elements[0]).getFullPath().toOSString();
			int n = manifestFilename.indexOf(File.separatorChar, 1);
			if (n != -1)
				manifestFilename = manifestFilename.substring(n + 1);
			manifestfileText.setText(manifestFilename);
		}
	}
}
 
开发者ID:thahn0720,项目名称:agui_eclipse_plugin,代码行数:33,代码来源:FJExportWizardConfigPage.java


示例8: selectWorkspaceDir

import org.eclipse.ui.views.navigator.ResourceComparator; //导入依赖的package包/类
private String selectWorkspaceDir() {

		String result = null;
		ILabelProvider lp = new WorkbenchLabelProvider();
		ITreeContentProvider cp = new WorkbenchContentProvider();

		ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(
				getShell(), lp, cp);
		dialog.setValidator(null);
		dialog.setAllowMultiple(false);
		dialog.setTitle("Select base directory to add"); //$NON-NLS-1$
		dialog.setMessage("msg?"); //$NON-NLS-1$
		ViewerFilter filter = new ViewerFilter() {
			public boolean select(Viewer viewer, Object parentElement,
					Object element) {
				boolean ok = (element instanceof Folder)
						|| (element instanceof Project);
				return ok;
			}
		};
		dialog.addFilter(filter);

		dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
		dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));

		if (dialog.open() == ElementTreeSelectionDialog.OK) {
			Object[] elements = dialog.getResult();
			if (elements.length == 1) {
				result = ((IResource) elements[0]).getFullPath().toOSString();
			}
		}
		return result;
	}
 
开发者ID:thahn0720,项目名称:agui_eclipse_plugin,代码行数:34,代码来源:FJExportWizardFilesSelectPage.java


示例9: handleManifestfileBrowse

import org.eclipse.ui.views.navigator.ResourceComparator; //导入依赖的package包/类
/**
     * Uses the standard container selection dialog to
     * choose the new value for the container field.
     */

    private void handleManifestfileBrowse() {

        String manifestFilename = getManifestfile();
        
        ILabelProvider lp= new WorkbenchLabelProvider();
        ITreeContentProvider cp= new WorkbenchContentProvider();

        ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(
                getShell(), lp, cp);
        dialog.setValidator(null);
        dialog.setAllowMultiple(false);
        dialog.setTitle("Select Manifest File"); //$NON-NLS-1$
//        dialog.setMessage("msg?"); //$NON-NLS-1$
        //dialog.addFilter(filter);
//        dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());   
        //TODO: Validate Input, Make project list IAdaptable
//        dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());   
        dialog.setInput(jproject.getProject());
        dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));

        if (dialog.open() == ElementTreeSelectionDialog.OK) {
            Object[] elements= dialog.getResult();
            if (elements.length == 1) {
                manifestFilename = ((IResource)elements[0]).getLocation().toOSString();
//                int n = manifestFilename.indexOf(File.separatorChar,1);
//                if (n!=-1)
//                    manifestFilename = manifestFilename.substring(n+1);
                manifestfileText.setText(manifestFilename);
            }
        }
    }
 
开发者ID:thahn0720,项目名称:agui_eclipse_plugin,代码行数:37,代码来源:ConfigPage.java


示例10: selectWorkspaceDir

import org.eclipse.ui.views.navigator.ResourceComparator; //导入依赖的package包/类
private String selectWorkspaceDir() {

        String result = null;
        ILabelProvider lp= new WorkbenchLabelProvider();
        ITreeContentProvider cp= new WorkbenchContentProvider();

        ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(
                getShell(), lp, cp);
        dialog.setValidator(null);
        dialog.setAllowMultiple(false);
        dialog.setTitle("Select base directory to add"); //$NON-NLS-1$
        dialog.setMessage("msg?"); //$NON-NLS-1$
        ViewerFilter filter = new ViewerFilter() {
            public boolean select(Viewer viewer, Object parentElement, Object element) {
                boolean ok = (element instanceof Folder) || (element instanceof Project);
                return ok;
            }
        };
        dialog.addFilter(filter);
        
        dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());   
        dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));

        if (dialog.open() == ElementTreeSelectionDialog.OK) {
            Object[] elements= dialog.getResult();
            if (elements.length == 1) {
                result = ((IResource)elements[0]).getFullPath().toOSString();
            }
        }
        return result;
    }
 
开发者ID:thahn0720,项目名称:agui_eclipse_plugin,代码行数:32,代码来源:FilesSelectPage.java


示例11: configureJAREntry

import org.eclipse.ui.views.navigator.ResourceComparator; //导入依赖的package包/类
/**
 * Shows the UI to configure a JAR or ZIP archive located in the workspace.
 * The dialog returns the configured classpath entry path or <code>null</code> if the dialog has
 * been canceled. The dialog does not apply any changes.
 *
 * @param shell The parent shell for the dialog.
 * @param initialEntry The path of the initial archive entry
 * @param usedEntries An array of paths that are already on the classpath and therefore should not be
 * selected again.
 * @return Returns the configured JAR path or <code>null</code> if the dialog has
 * been canceled by the user.
 */
public static IPath configureJAREntry(Shell shell, IPath initialEntry, IPath[] usedEntries) {
	if (initialEntry == null || usedEntries == null) {
		throw new IllegalArgumentException();
	}

	Class<?>[] acceptedClasses= new Class[] { IFile.class };
	TypedElementSelectionValidator validator= new TypedElementSelectionValidator(acceptedClasses, false);

	ArrayList<IResource> usedJars= new ArrayList<IResource>(usedEntries.length);
	IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
	for (int i= 0; i < usedEntries.length; i++) {
		IPath curr= usedEntries[i];
		if (!curr.equals(initialEntry)) {
			IResource resource= root.findMember(usedEntries[i]);
			if (resource instanceof IFile) {
				usedJars.add(resource);
			}
		}
	}

	IResource existing= root.findMember(initialEntry);

	FilteredElementTreeSelectionDialog dialog= new FilteredElementTreeSelectionDialog(shell, new WorkbenchLabelProvider(), new WorkbenchContentProvider());
	dialog.setValidator(validator);
	dialog.setTitle(NewWizardMessages.BuildPathDialogAccess_JARArchiveDialog_edit_title);
	dialog.setMessage(NewWizardMessages.BuildPathDialogAccess_JARArchiveDialog_edit_description);
	dialog.setInitialFilter(ArchiveFileFilter.JARZIP_FILTER_STRING);
	dialog.addFilter(new ArchiveFileFilter(usedJars, true, true));
	dialog.setInput(root);
	dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
	dialog.setInitialSelection(existing);

	if (dialog.open() == Window.OK) {
		IResource element= (IResource) dialog.getFirstResult();
		return element.getFullPath();
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:51,代码来源:BuildPathDialogAccess.java


示例12: chooseJAREntries

import org.eclipse.ui.views.navigator.ResourceComparator; //导入依赖的package包/类
/**
 * Shows the UI to select new JAR or ZIP archive entries located in the workspace.
 * The dialog returns the selected entries or <code>null</code> if the dialog has
 * been canceled. The dialog does not apply any changes.
 *
 * @param shell The parent shell for the dialog.
 * @param initialSelection The path of the element (container or archive) to initially select or <code>null</code> to not select an entry.
 * @param usedEntries An array of paths that are already on the classpath and therefore should not be
 * selected again.
 * @return Returns the new JAR paths or <code>null</code> if the dialog has
 * been canceled by the user.
 */
public static IPath[] chooseJAREntries(Shell shell, IPath initialSelection, IPath[] usedEntries) {
	if (usedEntries == null) {
		throw new IllegalArgumentException();
	}

	Class<?>[] acceptedClasses= new Class[] { IFile.class };
	TypedElementSelectionValidator validator= new TypedElementSelectionValidator(acceptedClasses, true);
	ArrayList<IResource> usedJars= new ArrayList<IResource>(usedEntries.length);
	IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
	for (int i= 0; i < usedEntries.length; i++) {
		IResource resource= root.findMember(usedEntries[i]);
		if (resource instanceof IFile) {
			usedJars.add(resource);
		}
	}
	IResource focus= initialSelection != null ? root.findMember(initialSelection) : null;

	FilteredElementTreeSelectionDialog dialog= new FilteredElementTreeSelectionDialog(shell, new WorkbenchLabelProvider(), new WorkbenchContentProvider());
	dialog.setHelpAvailable(false);
	dialog.setValidator(validator);
	dialog.setTitle(NewWizardMessages.BuildPathDialogAccess_JARArchiveDialog_new_title);
	dialog.setMessage(NewWizardMessages.BuildPathDialogAccess_JARArchiveDialog_new_description);
	dialog.setInitialFilter(ArchiveFileFilter.JARZIP_FILTER_STRING);
	dialog.addFilter(new ArchiveFileFilter(usedJars, true, true));
	dialog.setInput(root);
	dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
	dialog.setInitialSelection(focus);

	if (dialog.open() == Window.OK) {
		Object[] elements= dialog.getResult();
		IPath[] res= new IPath[elements.length];
		for (int i= 0; i < res.length; i++) {
			IResource elem= (IResource)elements[i];
			res[i]= elem.getFullPath();
		}
		return res;
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:52,代码来源:BuildPathDialogAccess.java


示例13: chooseWorkspaceArchive

import org.eclipse.ui.views.navigator.ResourceComparator; //导入依赖的package包/类
private String chooseWorkspaceArchive() {
	String initSelection= fArchiveField.getText();

	ILabelProvider lp= new WorkbenchLabelProvider();
	ITreeContentProvider cp= new WorkbenchContentProvider();
	Class<?>[] acceptedClasses= new Class[] { IFile.class };
	TypedElementSelectionValidator validator= new TypedElementSelectionValidator(acceptedClasses, true);

	IResource initSel= null;
	IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
	if (initSelection.length() > 0) {
		initSel= root.findMember(new Path(initSelection));
	}

	FilteredElementTreeSelectionDialog dialog= new FilteredElementTreeSelectionDialog(fShell, lp, cp);
	dialog.setInitialFilter(ArchiveFileFilter.JARZIP_FILTER_STRING);
	dialog.setAllowMultiple(false);
	dialog.setValidator(validator);
	dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
	dialog.setTitle(PreferencesMessages.JavadocConfigurationBlock_workspace_archive_selection_dialog_title);
	dialog.setMessage(PreferencesMessages.JavadocConfigurationBlock_workspace_archive_selection_dialog_description);
	dialog.setInput(root);
	dialog.setInitialSelection(initSel);
	dialog.setHelpAvailable(false);
	if (dialog.open() == Window.OK) {
		IResource res= (IResource) dialog.getFirstResult();
		return res.getFullPath().makeRelative().toString();
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:31,代码来源:JavadocConfigurationBlock.java


示例14: chooseInternal

import org.eclipse.ui.views.navigator.ResourceComparator; //导入依赖的package包/类
private String chooseInternal() {
	String initSelection= fPathField.getText();

	ILabelProvider lp= new WorkbenchLabelProvider();
	ITreeContentProvider cp= new WorkbenchContentProvider();
	Class<?>[] acceptedClasses= new Class[] { IProject.class, IFolder.class };
	TypedElementSelectionValidator validator= new TypedElementSelectionValidator(acceptedClasses, true);
	ViewerFilter filter= new TypedViewerFilter(acceptedClasses);

	IResource initSel= null;
	IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
	if (initSelection.length() > 0) {
		initSel= root.findMember(new Path(initSelection));
	}
	if (initSel == null) {
		initSel= root.findMember(fEntry.getPath());
	}

	ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(fShell, lp, cp);
	dialog.setAllowMultiple(false);
	dialog.setValidator(validator);
	dialog.addFilter(filter);
	dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
	dialog.setTitle(NewWizardMessages.NativeLibrariesDialog_intfiledialog_title);
	dialog.setMessage(NewWizardMessages.NativeLibrariesDialog_intfiledialog_message);
	dialog.setInput(root);
	dialog.setInitialSelection(initSel);
	dialog.setHelpAvailable(false);
	if (dialog.open() == Window.OK) {
		IResource res= (IResource) dialog.getFirstResult();
		return res.getFullPath().makeRelative().toString();
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:35,代码来源:NativeLibrariesConfigurationBlock.java


示例15: chooseFolder

import org.eclipse.ui.views.navigator.ResourceComparator; //导入依赖的package包/类
private IFolder chooseFolder(String title, String message, IPath initialPath) {
	Class<?>[] acceptedClasses= new Class[] { IFolder.class };
	ISelectionStatusValidator validator= new TypedElementSelectionValidator(acceptedClasses, false);
	ViewerFilter filter= new TypedViewerFilter(acceptedClasses, null);

	ILabelProvider lp= new WorkbenchLabelProvider();
	ITreeContentProvider cp= new WorkbenchContentProvider();

	IProject currProject= fCurrJProject.getProject();

	ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(getShell(), lp, cp);
	dialog.setValidator(validator);
	dialog.setTitle(title);
	dialog.setMessage(message);
	dialog.addFilter(filter);
	dialog.setInput(currProject);
	dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
	IResource res= currProject.findMember(initialPath);
	if (res != null) {
		dialog.setInitialSelection(res);
	}

	if (dialog.open() == Window.OK) {
		return (IFolder) dialog.getFirstResult();
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:28,代码来源:NewSourceFolderWizardPage.java


示例16: chooseContainer

import org.eclipse.ui.views.navigator.ResourceComparator; //导入依赖的package包/类
private IContainer chooseContainer() {
	Class<?>[] acceptedClasses= new Class[] { IProject.class, IFolder.class };
	ISelectionStatusValidator validator= new TypedElementSelectionValidator(acceptedClasses, false);
	IProject[] allProjects= fWorkspaceRoot.getProjects();
	ArrayList<IProject> rejectedElements= new ArrayList<IProject>(allProjects.length);
	IProject currProject= fCurrJProject.getProject();
	for (int i= 0; i < allProjects.length; i++) {
		if (!allProjects[i].equals(currProject)) {
			rejectedElements.add(allProjects[i]);
		}
	}
	ViewerFilter filter= new TypedViewerFilter(acceptedClasses, rejectedElements.toArray());

	ILabelProvider lp= new WorkbenchLabelProvider();
	ITreeContentProvider cp= new WorkbenchContentProvider();

	IResource initSelection= null;
	if (fOutputLocationPath != null) {
		initSelection= fWorkspaceRoot.findMember(fOutputLocationPath);
	}

	FolderSelectionDialog dialog= new FolderSelectionDialog(getShell(), lp, cp);
	dialog.setTitle(NewWizardMessages.BuildPathsBlock_ChooseOutputFolderDialog_title);
	dialog.setValidator(validator);
	dialog.setMessage(NewWizardMessages.BuildPathsBlock_ChooseOutputFolderDialog_description);
	dialog.addFilter(filter);
	dialog.setInput(fWorkspaceRoot);
	dialog.setInitialSelection(initSelection);
	dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));

	if (dialog.open() == Window.OK) {
		return (IContainer)dialog.getFirstResult();
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:36,代码来源:BuildPathsBlock.java


示例17: chooseFolder

import org.eclipse.ui.views.navigator.ResourceComparator; //导入依赖的package包/类
private IFolder chooseFolder(String title, String message, IPath initialPath) {
	Class<?>[] acceptedClasses= new Class[] { IFolder.class };
	ISelectionStatusValidator validator= new TypedElementSelectionValidator(acceptedClasses, false);
	ViewerFilter filter= new TypedViewerFilter(acceptedClasses, null);

	ILabelProvider lp= new WorkbenchLabelProvider();
	ITreeContentProvider cp= new WorkbenchContentProvider();

	IProject currProject= fNewElement.getJavaProject().getProject();

	ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(getShell(), lp, cp) {
		@Override
		protected Control createDialogArea(Composite parent) {
			Control result= super.createDialogArea(parent);
			PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IJavaHelpContextIds.BP_CHOOSE_EXISTING_FOLDER_TO_MAKE_SOURCE_FOLDER);
			return result;
		}
	};
	dialog.setValidator(validator);
	dialog.setTitle(title);
	dialog.setMessage(message);
	dialog.addFilter(filter);
	dialog.setInput(currProject);
	dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
	IResource res= currProject.findMember(initialPath);
	if (res != null) {
		dialog.setInitialSelection(res);
	}

	if (dialog.open() == Window.OK) {
		return (IFolder) dialog.getFirstResult();
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:35,代码来源:AddSourceFolderWizardPage.java


示例18: openProgramPathDialog

import org.eclipse.ui.views.navigator.ResourceComparator; //导入依赖的package包/类
public static String openProgramPathDialog(IProject project, Button button) throws OperationCancellation {
	ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(
		button.getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider());
	dialog.setTitle(LangUIMessages.ProgramPathDialog_title);
	dialog.setMessage(LangUIMessages.ProgramPathDialog_message);
	
	dialog.setInput(project);
	dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
	if(dialog.open() == IDialogConstants.OK_ID) {
		IResource resource = (IResource) dialog.getFirstResult();
		return resource.getProjectRelativePath().toPortableString();
	}
	throw new OperationCancellation();
}
 
开发者ID:GoClipse,项目名称:goclipse,代码行数:15,代码来源:ControlUtils.java


示例19: addMultipleEntries

import org.eclipse.ui.views.navigator.ResourceComparator; //导入依赖的package包/类
private void addMultipleEntries(ListDialogField field) {
    Class[] acceptedClasses = new Class[] { IFolder.class, IFile.class };
    ISelectionStatusValidator validator = new TypedElementSelectionValidator(
            acceptedClasses, true);
    ViewerFilter filter = new TypedViewerFilter(acceptedClasses);

    ILabelProvider lp = new WorkbenchLabelProvider();
    ITreeContentProvider cp = new WorkbenchContentProvider();

    String title, message;
    if (isExclusion(field)) {
        title = "Exclusion Pattern Selection";
        message = "&Choose folders or files to exclude:";
    } else {
        title = "Inclusion Pattern Selection";
        message = "&Choose folders or files to include:";
    }
    ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(),
            lp, cp);
    dialog.setTitle(title);
    dialog.setValidator(validator);
    dialog.setMessage(message);
    dialog.addFilter(filter);
    dialog.setInput(currSourceFolder);
    dialog.setInitialSelection(null);
    dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));

    if (dialog.open() == Window.OK) {
        Object[] objects = dialog.getResult();
        int existingSegments = currSourceFolder.getFullPath().segmentCount();

        for (int i = 0; i < objects.length; i++) {
            IResource curr = (IResource) objects[i];
            IPath path = curr.getFullPath().removeFirstSegments(existingSegments)
                    .makeRelative();
            String res;
            if (curr instanceof IContainer) {
                res = path.addTrailingSeparator().toString();
            } else {
                res = path.toString();
            }
            field.addElement(res);
        }
    }
}
 
开发者ID:iloveeclipse,项目名称:filesync4eclipse,代码行数:46,代码来源:InclusionExclusionDialog.java


示例20: openFileDialog

import org.eclipse.ui.views.navigator.ResourceComparator; //导入依赖的package包/类
private IPath openFileDialog(IPath path) {
    Class[] acceptedClasses = new Class[] { IFile.class, IFolder.class,
            IProject.class };
    ISelectionStatusValidator validator = new TypedElementSelectionValidator(
            acceptedClasses, false) {
        @Override
        public IStatus validate(Object[] elements) {
            if (elements.length > 1 || elements.length == 0
                    || !(elements[0] instanceof IFile)) {
                return errorStatus;
            }
            return okStatus;
        }
    };

    IProject[] allProjects = workspaceRoot.getProjects();
    ArrayList rejectedElements = new ArrayList(allProjects.length);
    for (int i = 0; i < allProjects.length; i++) {
        if (!allProjects[i].equals(project)) {
            rejectedElements.add(allProjects[i]);
        }
    }
    ViewerFilter filter = new TypedViewerFilter(acceptedClasses, rejectedElements
            .toArray());

    ILabelProvider lp = new WorkbenchLabelProvider();
    ITreeContentProvider cp = new WorkbenchContentProvider();

    IResource initSelection = null;
    if (path != null) {
        initSelection = project.findMember(path);
    }

    ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(),
            lp, cp);
    dialog.setTitle("Variables");
    dialog.setValidator(validator);
    dialog.setMessage("Select file with variables definition");
    dialog.addFilter(filter);
    dialog.setInput(workspaceRoot);
    dialog.setInitialSelection(initSelection);
    dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));

    if (dialog.open() == Window.OK) {
        return ((IFile) dialog.getFirstResult()).getProjectRelativePath();
    }
    return null;
}
 
开发者ID:iloveeclipse,项目名称:filesync4eclipse,代码行数:49,代码来源:ProjectSyncPropertyPage.java



注:本文中的org.eclipse.ui.views.navigator.ResourceComparator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java GeneratedMessageV3类代码示例发布时间:2022-05-22
下一篇:
Java LayoutParams类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap