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


Java ElementTreeSelectionDialog.setInput方法代碼示例

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


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

示例1: chooseWorkspace

import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; //導入方法依賴的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: main

import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; //導入方法依賴的package包/類
static public void main(String[] arg) throws Exception {
	Display display = new Display();
	Shell shell = new Shell(display);

	ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(shell, new PropertyLabelProvider(),
			new PropertyContentProvider());

	dialog.setInput(loadXmlReader(null));
	dialog.open();
	try {
		loadXmlReader(null);
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

}
 
開發者ID:bsteker,項目名稱:bdf2,代碼行數:18,代碼來源:XmlReader.java

示例3: selectFile

import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; //導入方法依賴的package包/類
/**
 * 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,代碼行數:25,代碼來源:WorkspaceTools.java

示例4: openFirstInstructionSelection

import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; //導入方法依賴的package包/類
/**
 * Opens the {@link EObject first instruction} selection dialog.
 * 
 * @param shell
 *            the {@link Shell} to use for display
 * @param resourceSet
 *            the {@link ResourceSet} to get the first instruction from
 * @return the selected first instruction {@link URI} if any selected, <code>null</code> otherwise
 */
public static EObject openFirstInstructionSelection(final Shell shell, ResourceSet resourceSet) {
	final EObject res;
	final ComposedAdapterFactory fatory = new ComposedAdapterFactory(
			ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
	fatory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
	fatory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());

	ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(shell,
			new AdapterFactoryLabelProvider(fatory), new AdapterFactoryContentProvider(fatory));
	dialog.setTitle("Select first instruction");
	dialog.setMessage("Select the first instruction:");
	dialog.setInput(resourceSet);
	if (dialog.open() == Window.OK) {
		res = (EObject)dialog.getFirstResult();
	} else {
		res = null;
	}
	fatory.dispose();
	return res;
}
 
開發者ID:SiriusLab,項目名稱:ModelDebugging,代碼行數:30,代碼來源:DSLLaunchConfigurationTab.java

示例5: selectInProject

import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; //導入方法依賴的package包/類
private void selectInProject() {
    ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(),
            new WorkbenchLabelProvider(), new BaseWorkbenchContentProvider());
    dialog.setTitle("Select a file in the project:");
    dialog.setMessage("Select a file in the project:");
    // Filter to the project
    dialog.addFilter(new ViewerFilter() {
        public boolean select(Viewer viewer, Object parentElement, Object element) {
            if (element instanceof IProject) {
                return ((IProject) element).getName().equals(project.getName());
            }
            // we want a folder
            return defaultExtension != null || element instanceof IContainer;
        }
    });
    dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
    // TODO try to preselect the current file
    dialog.open();
    Object[] results = dialog.getResult();
    if ((results != null) && (results.length > 0) && (results[0] instanceof IResource)) {
        IPath path = ((IResource) results[0]).getFullPath();
        setProjectLoc(path.removeFirstSegments(1).makeRelative().toString());
    }
}
 
開發者ID:apache,項目名稱:ant-ivyde,代碼行數:25,代碼來源:PathEditor.java

示例6: run

import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; //導入方法依賴的package包/類
@Override
   public void run() {
ElementTreeSelectionDialog isoTreeSelectionDialog = new ElementTreeSelectionDialog(
	Display.getDefault().getActiveShell(), new IsoTreeLabelProvider(), new IsoTreeContentProvider());
isoTreeSelectionDialog.setTitle("Iso tree");
isoTreeSelectionDialog.setMessage("Select the destination directory to place the selected files.");
isoTreeSelectionDialog.setInput(IsoExplorerSashForm.getInstance().getIsoDirectoriesTree().getInput());

switch (isoTreeSelectionDialog.open()) {
case Window.OK:
    executeAddFiles((ITreeNode) isoTreeSelectionDialog.getFirstResult());
    executeAction();
    isoTreeSelectionDialog.close();
default:
    return;
}
   }
 
開發者ID:Cavallinux,項目名稱:jisocreator,代碼行數:18,代碼來源:AddFileAction.java

示例7: selectFolderInProject

import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; //導入方法依賴的package包/類
private IFolder selectFolderInProject() {
	ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getControl().getShell(),
			new WorkbenchLabelProvider(), new BaseWorkbenchContentProvider());
	dialog.setTitle("Select View Root");
	dialog.setMessage("select the view root:");
	dialog.setInput(getProject());
	dialog.addFilter(new ViewerFilter() {

		public boolean select(Viewer viewer, Object parentElement, Object element) {
			return element instanceof IFolder && ((IFolder) element).isAccessible();
		}
	});
	if (Window.OK == dialog.open()) {
		Object[] result = dialog.getResult();
		if (result.length > 0) {
			return (IFolder) result[0];
		}
	}
	return null;
}
 
開發者ID:cntoplolicon,項目名稱:seasar2-assistant,代碼行數:21,代碼來源:Seasar2AssistantPropertyPage.java

示例8: chooseWorkspaceDirectory

import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; //導入方法依賴的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

示例9: openSiriusModelSelection

import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; //導入方法依賴的package包/類
/**
 * Opens the model selection dialog.
 * 
 * @param parent
 *            the parent {@link Composite}
 */
private void openSiriusModelSelection(final Composite parent) {
	ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(parent.getShell(),
			new WorkbenchLabelProvider(), new FilteredFileContentProvider(new String[] {
					SiriusUtil.SESSION_RESOURCE_EXTENSION }));
	dialog.setTitle("Select model file");
	dialog.setMessage("Select the model file to execute:");
	dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
	if (dialog.open() == Window.OK) {
		siriusResourceURIText.setText(((IFile)dialog.getFirstResult()).getFullPath().toString());
	}
}
 
開發者ID:eclipse,項目名稱:gemoc-studio-modeldebugging,代碼行數:18,代碼來源:DSLLaunchConfigurationTab.java

示例10: openModelSelection

import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; //導入方法依賴的package包/類
/**
 * Opens the model selection dialog.
 * 
 * @param parent
 *            the parent {@link Composite}
 */
private void openModelSelection(final Composite parent) {
	ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(parent.getShell(),
			new WorkbenchLabelProvider(), new FilteredFileContentProvider(extensions));
	dialog.setTitle("Select model file");
	dialog.setMessage("Select the model file to execute:");
	dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
	if (dialog.open() == Window.OK) {
		resourceURIText.setText(((IFile)dialog.getFirstResult()).getFullPath().toString());
	}
}
 
開發者ID:eclipse,項目名稱:gemoc-studio-modeldebugging,代碼行數:17,代碼來源:DSLLaunchConfigurationTab.java

示例11: handleManifestfileBrowse

import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; //導入方法依賴的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

示例12: selectWorkspaceDir

import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; //導入方法依賴的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

示例13: handleManifestfileBrowse

import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; //導入方法依賴的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

示例14: selectWorkspaceDir

import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; //導入方法依賴的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

示例15: setUpWhitelistPackagesDialog

import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; //導入方法依賴的package包/類
private void setUpWhitelistPackagesDialog() {
  IJavaProject project = getSelectedProject();
  ElementTreeSelectionDialog dialog =
      new ElementTreeSelectionDialog(getControl().getShell(),
          new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_BASICS),
          new JavaPackageElementContentProvider());
  dialog.setInput(project);
  dialog.addFilter(new ViewerFilter() {

    @Override
    public boolean select(Viewer viewer, Object parentElement, Object element) {
      if (element instanceof IPackageFragment) {
        return !((IPackageFragment) element).getElementName().equals("");
      }
      if (element instanceof ICompilationUnit) {
        return false;
      }
      return true;
    }
    
  });
  dialog.setMessage("Choose packages to whitelist:");

  if (dialog.open() == Window.OK) {
    Object[] results = dialog.getResult();
    String[] stringArray = new String[results.length];
    for (int i = 0; i < results.length; i++) {
      if (results[i] instanceof IJavaElement) {
        stringArray[i] = ((IJavaElement) results[i]).getElementName();
      }
    }
    whiteListList.add(stringArray);
    setTabDirty();
  }
}
 
開發者ID:mhevery,項目名稱:testability-explorer,代碼行數:36,代碼來源:TestabilityLaunchConfigurationTab.java


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