當前位置: 首頁>>代碼示例>>Java>>正文


Java ElementTreeSelectionDialog.OK屬性代碼示例

本文整理匯總了Java中org.eclipse.ui.dialogs.ElementTreeSelectionDialog.OK屬性的典型用法代碼示例。如果您正苦於以下問題:Java ElementTreeSelectionDialog.OK屬性的具體用法?Java ElementTreeSelectionDialog.OK怎麽用?Java ElementTreeSelectionDialog.OK使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.eclipse.ui.dialogs.ElementTreeSelectionDialog的用法示例。


在下文中一共展示了ElementTreeSelectionDialog.OK屬性的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: selectFile

/**
 * Open a dialog box asking the user to select an existing project under the
 * current workspace.
 *
 * @param parentShell
 * @param title 
 */
public static IResource selectFile(Shell parentShell, String title) {
  ElementTreeSelectionDialog dialog =
      new ElementTreeSelectionDialog(
          parentShell,
          new WorkbenchLabelProvider(),
          new WorkbenchContentProvider()
      );

  dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
  dialog.setTitle(title);
  dialog.setAllowMultiple(false);

  if(dialog.open() == ElementTreeSelectionDialog.OK) {
    return (IResource) dialog.getFirstResult();
  }
  return null;
}
 
開發者ID:google,項目名稱:depan,代碼行數:24,代碼來源:WorkspaceTools.java

示例2: handleManifestfileBrowse

/**
 * 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,代碼行數:32,代碼來源:FJExportWizardConfigPage.java

示例3: selectWorkspaceDir

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,代碼行數:33,代碼來源:FJExportWizardFilesSelectPage.java

示例4: handleManifestfileBrowse

/**
     * 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,代碼行數:36,代碼來源:ConfigPage.java

示例5: selectWorkspaceDir

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,代碼行數:31,代碼來源:FilesSelectPage.java

示例6: open

/**
 * Opens the selection dialog and tells if the user validated to selection.
 *
 * @return	true when a selection was made, false otherwise.
 */
public boolean open() {
    Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
    ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService()
            .getSelection();
    IStructuredSelection structuredSelection = (selection != null && selection instanceof IStructuredSelection)
            ? (IStructuredSelection) selection
            : new StructuredSelection();
    boolean result = false;

    try {
        ResourceCollector collector = root != null ? ResourceCollector.run(root) : ResourceCollector.run();

        hadDoxyfiles = collector.isEmpty() == false;

        if (collector.isEmpty() == false) {
            MyDoxyfileSelectionDialog selectionDialog = new MyDoxyfileSelectionDialog(shell, new MyLabelProvider(),
                    new MyContentProvider());

            selectionDialog.setAllowMultiple(false);
            selectionDialog.setInput(collector.getDoxyfiles());
            selectionDialog.setValidator(new MySelectionValidator());
            selectionDialog.setEmptyListMessage("No Doxyfile found in opened projects.");
            selectionDialog.setMessage("Select a Doxyfile:");
            selectionDialog.setTitle("Doxyfile Selection");
            selectionDialog.setInitialSelections(structuredSelection.toArray());

            // Opens the selection dialog and save the selection.
            if (selectionDialog.open() == ElementTreeSelectionDialog.OK) {
                doxyfile = (IFile) selectionDialog.getFirstResult();
                result = true;
            }
        }
    } catch (Throwable t) {
        eclox.ui.Plugin.log(t);
    }

    return result;
}
 
開發者ID:anb0s,項目名稱:eclox,代碼行數:43,代碼來源:DoxyfileSelector.java


注:本文中的org.eclipse.ui.dialogs.ElementTreeSelectionDialog.OK屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。