类org.eclipse.ui.dialogs.ContainerSelectionDialog源码实例Demo

下面列出了怎么用org.eclipse.ui.dialogs.ContainerSelectionDialog的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: xds-ide   文件: CompilerWorkingDirectoryBlock.java
/**
 * Show a dialog that lets the user select a working directory from 
 * the workspace
 */
private void handleWorkspaceDirBrowseButtonSelected() {
    IContainer currentContainer= getContainer(getOtherDirectoryText());
    if (currentContainer == null) {
        currentContainer = ResourcesPlugin.getWorkspace().getRoot();
    } 
    ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), currentContainer, false, Messages.CompilerWorkingDirectoryBlock_SelectWorkspaceRelWorkDir+':'); 
    dialog.showClosedProjects(false);
    dialog.open();
    Object[] results = dialog.getResult();      
    if ((results != null) && (results.length > 0) && (results[0] instanceof IPath)) {
        IPath path = (IPath)results[0];
        String containerName = path.makeRelative().toString();
        setOtherWorkingDirectoryText("${workspace_loc:" + containerName + "}"); //$NON-NLS-1$ //$NON-NLS-2$
        if (actionListener != null) {
            actionListener.actionPerformed(null);
        }
    }           
}
 
源代码2 项目: dawnsci   文件: H5ResourcePage.java
/**
   * Queries the user to supply a container resource.
   *
   * @return the path to an existing or new container, or <code>null</code> if the
   *    user cancelled the dialog
   */
  protected IPath queryForContainer(IContainer initialSelection, String msg,
          String title) {
      ContainerSelectionDialog dialog = new ContainerSelectionDialog(
              getControl().getShell(), initialSelection,
              false, msg);
      if (title != null) {
	dialog.setTitle(title);
}
      dialog.showClosedProjects(false);
      dialog.open();
      Object[] result = dialog.getResult();
      if (result != null && result.length == 1) {
          return (IPath) result[0];
      }
      return null;
  }
 
源代码3 项目: birt   文件: IDEResourcePageHelper.java
protected void handleBrowseWorkspace( )
{
	ContainerSelectionDialog dialog = new ContainerSelectionDialog( getControl( ).getShell( ),
			ResourcesPlugin.getWorkspace( ).getRoot( ),
			true,
			ContainerSelectionDialog_Message );
	if ( dialog.open( ) == Window.OK )
	{
		Object[] result = dialog.getResult( );
		if ( result.length == 0 )
			return;
		IPath path = (IPath) result[0];
		//fLocationText.setText("${workspace_loc:" + path.makeRelative().toString() + "}"); //$NON-NLS-1$ //$NON-NLS-2$
		notifyTextChange( "${workspace_loc:" //$NON-NLS-1$
				+ path.makeRelative( ).toString( )
				+ "}" ); //$NON-NLS-1$
	}
}
 
源代码4 项目: Pydev   文件: PyMoveResourceAction.java
private IPath pyQueryDestinationResource() {
    // start traversal at root resource, should probably start at a
    // better location in the tree
    String title;
    if (selected.size() == 1) {
        title = "Choose destination for ''" + selected.get(0).getName() + "'':";
    } else {
        title = "Choose destination for " + selected.size() + " selected resources:";
    }
    ContainerSelectionDialog dialog = new ContainerSelectionDialog(shellProvider.getShell(),
            selected.get(0).getParent(), true, title);
    dialog.setTitle("Move Resources");
    dialog.setValidator(this);
    dialog.showClosedProjects(false);
    dialog.open();
    Object[] result = dialog.getResult();
    if (result != null && result.length == 1) {
        return (IPath) result[0];
    }
    return null;
}
 
源代码5 项目: Pydev   文件: WorkingDirectoryBlock.java
/**
 * Show a dialog that lets the user select a working directory from 
 * the workspace
 */
private void handleWorkspaceDirBrowseButtonSelected() {
    IContainer currentContainer = getContainer();
    if (currentContainer == null) {
        currentContainer = ResourcesPlugin.getWorkspace().getRoot();
    }
    ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), currentContainer, false,
            "Select a workspace relative working directory");
    dialog.showClosedProjects(false);
    dialog.open();
    Object[] results = dialog.getResult();
    if ((results != null) && (results.length > 0) && (results[0] instanceof IPath)) {
        IPath path = (IPath) results[0];
        String containerName = path.makeRelative().toString();
        setOtherWorkingDirectoryText("${workspace_loc:" + containerName + "}"); //$NON-NLS-1$ //$NON-NLS-2$
    }
}
 
源代码6 项目: Pydev   文件: PyCodeCoverageView.java
@Override
public void run() {
    ContainerSelectionDialog dialog = new ContainerSelectionDialog(getSite().getShell(), null, false,
            "Choose folder to be analyzed in the code-coverage");
    dialog.showClosedProjects(false);
    if (dialog.open() != Window.OK) {
        return;
    }
    Object[] objects = dialog.getResult();
    if (objects.length == 1) { //only one folder can be selected
        if (objects[0] instanceof IPath) {
            IPath p = (IPath) objects[0];

            IWorkspace w = ResourcesPlugin.getWorkspace();
            IContainer folderForLocation = (IContainer) w.getRoot().findMember(p);
            setSelectedContainer(folderForLocation);
        }
    }
}
 
源代码7 项目: neoscada   文件: NewArchiveWizardPage.java
/**
 * Uses the standard container selection dialog to choose the new value for the container field.
 */

private void handleBrowse ()
{
    final ContainerSelectionDialog dialog = new ContainerSelectionDialog ( getShell (), ResourcesPlugin.getWorkspace ().getRoot (), false, "Select new file container" );
    if ( dialog.open () == Window.OK )
    {
        final Object[] result = dialog.getResult ();
        if ( result.length == 1 )
        {
            this.containerText.setText ( ( (Path)result[0] ).toString () );
        }
    }
}
 
源代码8 项目: corrosion   文件: InputComponent.java
public void createContainerSelection(Supplier<IContainer> containerSupplier) {
	createSelectionButton();
	browseButton.addSelectionListener(widgetSelectedAdapter(e -> {
		ContainerSelectionDialog dialog = new ContainerSelectionDialog(browseButton.getShell(),
				containerSupplier.get(), true, this.labelString);
		dialog.setTitle(Messages.LaunchUI_selection);
		int returnCode = dialog.open();
		Object[] results = dialog.getResult();
		if (returnCode == 0 && results.length > 0) {
			text.setText(((Path) results[0]).makeRelative().toString());
			editListener.modifyText(null);
		}
	}));
}
 
public void handleChooseContainer(Text base_target_text,String dialogTitel) {
	IContainer initialRoot = toContainer(base_target_text.getText());
	ContainerSelectionDialog containerSelectionDialog = new ContainerSelectionDialog(getShell(),
			initialRoot, false, dialogTitel);
	containerSelectionDialog.open();
	Object[] result = containerSelectionDialog.getResult();
	if (result != null && result.length == 1) {
		IPath container = (IPath) result[0];
		base_target_text.setText(container.toString());
	}
	validatePage();
}
 
private void handleBrowse() {
	ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), ResourcesPlugin.getWorkspace()
	                .getRoot(), false, "Select Project/Folder");
	if (dialog.open() == ContainerSelectionDialog.OK) {
		Object[] result = dialog.getResult();
		if (result.length == 1) {
			containerText.setText(((Path) result[0]).toString());
		}
	}
}
 
源代码11 项目: typescript.java   文件: NewClassWizardPage.java
/**
 * Uses the standard container selection dialog to choose the new value for
 * the container field.
 */

private void handleBrowse() {
	ContainerSelectionDialog dialog = new ContainerSelectionDialog(
			getShell(), ResourcesPlugin.getWorkspace().getRoot(), false,
			"Select new file container");
	if (dialog.open() == ContainerSelectionDialog.OK) {
		Object[] result = dialog.getResult();
		if (result.length == 1) {
			containerText.setText(((Path) result[0]).toString());
		}
	}
}
 
源代码12 项目: depan   文件: WorkspaceTools.java
/**
 * Open a dialog box asking the user to select an existing project under the
 * current workspace.
 *
 * @param parentShell
 * @param defaultValue
 * @return a String representing the name of the chosen project, or
 *         defaultValue if nothing was selected (or "cancel" button was
 *         pressed...)
 */
public static String selectProject(Shell parentShell, String defaultValue) {
  IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
  ContainerSelectionDialog dialog = new ContainerSelectionDialog(
      parentShell, workspaceRoot, false, "Select new file container");
  if (dialog.open() == ContainerSelectionDialog.OK) {
    Object[] result = dialog.getResult();
    if (result.length == 1) {
      return ((Path) result[0]).toString();
    }
  }
  return defaultValue;
}
 
源代码13 项目: gama   文件: AbstractNewModelWizardPage.java
/**
 * Uses the standard container selection dialog to choose the new value for the container field.
 */
protected void handleContainerBrowse() {
	final ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(),
			ResourcesPlugin.getWorkspace().getRoot(), false, "Select a project or a folder");
	if (dialog.open() == Window.OK) {
		final Object[] result = dialog.getResult();
		if (result.length == 1) {
			containerText.setText(((Path) result[0]).toString());
		}
	}
}
 
源代码14 项目: APICloud-Studio   文件: NewFileWizardPage.java
private void handleBrowse()
{
  ContainerSelectionDialog dialog = new ContainerSelectionDialog(
    getShell(), ResourcesPlugin.getWorkspace().getRoot(), false, 
    "Select new file container");
  if (dialog.open() == 0) {
    Object[] result = dialog.getResult();
    if (result.length == 1)
      this.containerText.setText(((Path)result[0]).toString());
  }
}
 
源代码15 项目: yang-design-studio   文件: YangPageFile.java
/**
 * Uses the standard container selection dialog to choose the new value for
 * the container field.
 */

private void handleBrowse() {
	ContainerSelectionDialog dialog = new ContainerSelectionDialog(
			getShell(), ResourcesPlugin.getWorkspace().getRoot(), false,
			"Select new file container");
	if (dialog.open() == ContainerSelectionDialog.OK) {
		Object[] result = dialog.getResult();
		if (result.length == 1) {
			containerText.setText(((Path) result[0]).toString());
		}
	}
}
 
源代码16 项目: RADL   文件: RadlNewWizardPage.java
private void selectFolder() {
  ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), root, false, "Select Location");
  if (dialog.open() == ContainerSelectionDialog.OK) {
    Object[] result = dialog.getResult();
    if (result.length == 1) {
      folderText.setText(((Path)result[0]).toString());
    }
  }
}
 
源代码17 项目: saros   文件: ProjectOptionComposite.java
private String getProjectDialog(String title) {
  ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), null, false, title);

  dialog.open();

  Object[] result = dialog.getResult();

  if (result == null || result.length == 0) return null;

  return ResourcesPlugin.getWorkspace()
      .getRoot()
      .findMember((Path) result[0])
      .getProject()
      .getName();
}
 
源代码18 项目: goclipse   文件: NewSourceFileComposite.java
/**
 * Uses the standard container selection dialog to choose the new value for
 * the container field.
 */
private void handleBrowse() {
	ContainerSelectionDialog dialog = new ContainerSelectionDialog(
	        getShell(), ResourcesPlugin.getWorkspace().getRoot(), false,
	        "Select new source file location");

	if (dialog.open() == Window.OK) {
		Object[] result = dialog.getResult();
		if (result.length == 1) {
			sourceFolderName.setText(result[0].toString());
		}
	}
	
	fireDialogChange();
}
 
源代码19 项目: uima-uimaj   文件: AbstractNewWizardPage.java
/**
 * Handle browse.
 */
void handleBrowse() {
  ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), ResourcesPlugin
          .getWorkspace().getRoot(), false, "Select a containing folder");
  if (dialog.open() == Window.OK) {
    Object[] result = dialog.getResult();
    if (result.length == 1) {
      containerText.setText(((Path) result[0]).toOSString());
    }
  }
}
 
 类所在包
 同包方法