当前位置: 首页>>代码示例>>Java>>正文


Java ResourceListSelectionDialog.getResult方法代码示例

本文整理汇总了Java中org.eclipse.ui.dialogs.ResourceListSelectionDialog.getResult方法的典型用法代码示例。如果您正苦于以下问题:Java ResourceListSelectionDialog.getResult方法的具体用法?Java ResourceListSelectionDialog.getResult怎么用?Java ResourceListSelectionDialog.getResult使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.ui.dialogs.ResourceListSelectionDialog的用法示例。


在下文中一共展示了ResourceListSelectionDialog.getResult方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: widgetSelected

import org.eclipse.ui.dialogs.ResourceListSelectionDialog; //导入方法依赖的package包/类
@Override
public void widgetSelected(SelectionEvent e) {
	final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
	final ResourceListSelectionDialog elementSelector = new ResourceListSelectionDialog(shell, ResourcesPlugin.getWorkspace().getRoot(), IResource.DEPTH_INFINITE | IResource.FILE ) {
		@Override
		protected boolean select(IResource resource) {
			// TODO Auto-generated method stub
			return resource.getName().toLowerCase().endsWith(".hawkmodel");
		}
	};
	elementSelector.setTitle("Remote Hawk access descriptors in the workspace");
	elementSelector.setMessage("Select a remote Hawk access descriptor");
	elementSelector.open();
	
	if (elementSelector.getReturnCode() == Window.OK){
		IFile f = (IFile) elementSelector.getResult()[0];
		text.setText(f.getFullPath().toString());
	}
}
 
开发者ID:mondo-project,项目名称:mondo-integration,代码行数:20,代码来源:RemoteHawkModelConfigurationDialog.java

示例2: handleEvent

import org.eclipse.ui.dialogs.ResourceListSelectionDialog; //导入方法依赖的package包/类
@Override
public void handleEvent(Event evt) {
    if (SWT.Selection == evt.type) {
        ResourceListSelectionDialog dlg = new ResourceListSelectionDialog(
            PathPropertyPage.this.getShell(), currentProject, IResource.FOLDER);
        if (ResourceListSelectionDialog.OK == dlg.open()) {
            Object[] selected = dlg.getResult();
            if (null != selected && selected.length > 0 && selected[0] instanceof IResource) {
                IResource res = (IResource) selected[0];
                try {
                    projectConfiguration.setPath(kind, res.getFullPath().toFile());
                } catch (IOException e) {
                    MessageDialog.openError(getShell(), "Error setting path", e.getMessage());
                }
            }
        }
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:19,代码来源:PathPropertyPage.java

示例3: browseFiles

import org.eclipse.ui.dialogs.ResourceListSelectionDialog; //导入方法依赖的package包/类
/***
 * Open a resource chooser to select a file
 **/
protected void browseFiles() {
	IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
	ResourceListSelectionDialog dialog = new ResourceListSelectionDialog(getShell(), root, IResource.FILE);
	dialog.setTitle("Search File");
	if (dialog.open() == Window.OK) {
		Object[] files = dialog.getResult();
		IFile file = (IFile) files[0];
		fileText.setText(file.getFullPath().toString());
	}

}
 
开发者ID:eclipse,项目名称:n4js,代码行数:15,代码来源:LaunchConfigurationMainTab.java

示例4: searchResource

import org.eclipse.ui.dialogs.ResourceListSelectionDialog; //导入方法依赖的package包/类
/**
 * Open a resource chooser to select a resource as the main entry point for the launch.
 */
protected String searchResource() {
	IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
	ResourceListSelectionDialog dialog = new ResourceListSelectionDialog(getShell(), root,
			getAcceptedResourceTypes());
	dialog.setTitle("Search " + getResourceLabel());
	if (dialog.open() == Window.OK) {
		Object[] files = dialog.getResult();
		IFile file = (IFile) files[0];
		return file.getFullPath().toString();
	}
	return null;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:16,代码来源:AbstractLaunchConfigurationMainTab.java

示例5: browseEiffelFiles

import org.eclipse.ui.dialogs.ResourceListSelectionDialog; //导入方法依赖的package包/类
protected void browseEiffelFiles() {
	ResourceListSelectionDialog dialog = new ResourceListSelectionDialog(
			getShell(), ResourcesPlugin.getWorkspace().getRoot(), IResource.FILE);
	dialog.setTitle("Eiffel Program");
	dialog.setMessage("Select Eiffel Program");
	if (dialog.open() == Window.OK) {
		Object[] files = dialog.getResult();
		IFile file = (IFile) files[0];
		eiffelProgramText.setText(file.getFullPath().toString());
	}
}
 
开发者ID:Imhotup,项目名称:LibertyEiffel-Eclipse-Plugin,代码行数:12,代码来源:LibertyEiffelMainTab.java

示例6: changeModel

import org.eclipse.ui.dialogs.ResourceListSelectionDialog; //导入方法依赖的package包/类
void changeModel(final TransformationEditor editor,
        final String title,
        final CTabItem tab) {
    final IFolder classesFolder = editor.project().getFolder("target/classes");
    final List<IResource> classes = new ArrayList<>();
    try {
        findClasses(classesFolder, classes);
        final ResourceListSelectionDialog dlg =
                new ResourceListSelectionDialog(getShell(),
                        classes.toArray(new IResource[classes.size()])) {

                    @Override
                    protected Control createDialogArea(final Composite parent) {
                        final Composite dlgArea = (Composite) super.createDialogArea(parent);
                        for (final Control child : dlgArea.getChildren()) {
                            if (child instanceof Text) {
                                ((Text) child).setText(model == null ? "*" : model.getName());
                                break;
                            }
                        }
                        return dlgArea;
                    }
                };
        dlg.setTitle("Select " + title);
        if (dlg.open() != Window.OK) {
            return;
        }

        final IFile file = (IFile) dlg.getResult()[0];
        String name =
                file.getFullPath().makeRelativeTo(classesFolder.getFullPath()).toString()
                        .replace('/', '.');
        name = name.substring(0, name.length() - ".class".length());

        model = editor.changeModel(model, name);
        tab.setText(title + ": " + model.getName());
        modelViewer.rootModel = model;
        refresh();
        layout();
    } catch (final Exception e) {
        Activator.error(e);
    }
}
 
开发者ID:fabric8io,项目名称:data-mapper,代码行数:44,代码来源:ModelTabFolder.java


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