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


Java ElementTreeSelectionDialog.getFirstResult方法代碼示例

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


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

示例3: 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

示例4: 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

示例5: chooseInternal

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

示例6: chooseFolder

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

示例7: chooseFolder

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

示例8: prompt

import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; //導入方法依賴的package包/類
/**
     * Prompts the user to choose a file @see PromptExpanderBase#prompt()
     */
    public void prompt() {
        ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider());
        dialog.setTitle(Txt.s("Variable.Verilog.Promp.Dialog.Title")); 
        dialog.setMessage(Txt.s("Variable.Verilog.Promp.Dialog.Message")); 
        dialog.setInput(ResourcesPlugin.getWorkspace().getRoot()); 
        dialog.setSorter(new ResourceSorter(ResourceSorter.NAME));
        if (dialog.open() == Window.OK) {
            IResource resource = (IResource) dialog.getFirstResult();
//            dialogResultString = resource.getLocation().toOSString();
            dialogResultString = resource.getFullPath().toOSString();
        }    
    }
 
開發者ID:Elphel,項目名稱:vdt-plugin,代碼行數:16,代碼來源:VerilogPrompt.java

示例9: openProgramPathDialog

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

示例10: openXtpScriptSelectionDialog

import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; //導入方法依賴的package包/類
/**
 * Opens a dialog which prompts for a dLabPro script (extension
 * <code>*.?tp</code>)
 * 
 * @param iShell the parent shell for the dialog
 * @return the selected resource or <code>null</code> if the dialog was
 * canceled
 */
public static IFile openXtpScriptSelectionDialog(Shell iShell)
{
  ResourcePatternFilter iXtpFilter = new ResourcePatternFilter()
  {
    public boolean select(Viewer viewer, Object parentElement, Object element)
    {
      if (element instanceof IFile)
      {
        return !super.select(viewer, parentElement, element);
      }
      else
      {
        return true;
      }
    }
  };
  iXtpFilter.setPatterns(new String[] { "*.?tp" });
  
  WorkbenchLabelProvider iLp = new WorkbenchLabelProvider();
  WorkbenchContentProvider iCp = new WorkbenchContentProvider();
  ElementTreeSelectionDialog iDlg = new ElementTreeSelectionDialog(iShell,
      iLp,iCp);
  iDlg.setInput(ResourcesPlugin.getWorkspace().getRoot());
  iDlg.setTitle("Script Selection");
  iDlg.setMessage("Choose a dLabPro script");
  iDlg.addFilter(iXtpFilter);
  
  if (iDlg.open() == Window.OK)
    return (IFile)iDlg.getFirstResult();
  else
    return null;
}
 
開發者ID:matthias-wolff,項目名稱:dLabPro-Plugin,代碼行數:41,代碼來源:WorkbenchUtil.java

示例11: openElementTreeSelectionDialog

import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; //導入方法依賴的package包/類
/**
 * 트리에서 요소 선택하는 다이얼로그 열기
 * 
 * @param isSelectAnalysisModel
 *            void
 */
private void openElementTreeSelectionDialog(boolean isSelectAnalysisModel) {
    ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(),
        new ProjectItemLabelProvider(),
        new ProjectItemTreeContentProvider(1));

    dialog.setTitle(UMLMessage.LABEL_USECASE_TRACE_MATRIX_CREATION);
    if (isSelectAnalysisModel) {
        dialog.setMessage(UMLMessage.MESSAGE_SELECT_ANALYSIS_MODEL_FOR_CREATE_USECASE_TRACE_MATRIX);
    } else {
        dialog.setMessage(UMLMessage.MESSAGE_SELECT_DESIGN_MODEL_FOR_CREATE_USECASE_TRACE_MATRIX);
    }
    dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
    dialog.addFilter(new ViewerFilter() {
        /**
         * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer,
         *      java.lang.Object, java.lang.Object)
         */
        @Override
        public boolean select(Viewer viewer, Object parentElement, Object element) {
            if (element instanceof IProject) {
                return true;
            } else if (parentElement instanceof IFolder && element instanceof Model) {
                return true;
            } else if (element instanceof IResource) {
                if (((IResource) element).getName().startsWith(UICoreConstant.PROJECT_CONSTANTS__DOT)) {
                    return false;
                }
                return true;
            }
            return false;
        }
    });

    if (dialog.open() != Window.OK) {
        return;
    }

    if (!(dialog.getFirstResult() instanceof Model)) {
        return;
    }

    if (isSelectAnalysisModel) {
        if (getSelectedDesignModel() != null) {
            if (getSelectedDesignModel().equals(dialog.getFirstResult())) {
                MessageDialog.openWarning(getShell(),
                    UMLMessage.LABEL_USECASE_TRACE_MATRIX_CREATION,
                    UMLMessage.MESSAGE_WARNING_DO_NOT_SELECT_SAME_MODEL);
                return;
            }
        }
    } else {
        if (getSelectedAnalysisModel() != null) {
            if (getSelectedAnalysisModel().equals(dialog.getFirstResult())) {
                MessageDialog.openWarning(getShell(),
                    UMLMessage.LABEL_USECASE_TRACE_MATRIX_CREATION,
                    UMLMessage.MESSAGE_WARNING_DO_NOT_SELECT_SAME_MODEL);
                return;
            }
        }
    }

    if (isSelectAnalysisModel) {
        setSelectedAnalysisModel((Model) dialog.getFirstResult());
        analysisText.setText(getSelectedAnalysisModel().getName());
    } else {
        setSelectedDesignModel((Model) dialog.getFirstResult());
        designText.setText(getSelectedDesignModel().getQualifiedName());
    }
}
 
開發者ID:SK-HOLDINGS-CC,項目名稱:NEXCORE-UML-Modeler,代碼行數:76,代碼來源:SelectModelDialog.java

示例12: chooseExclusionPattern

import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; //導入方法依賴的package包/類
private IPath chooseExclusionPattern() {
    Class[] acceptedClasses = new Class[] { IFolder.class, IFile.class };
    ISelectionStatusValidator validator = new TypedElementSelectionValidator(
            acceptedClasses, false);
    ViewerFilter filter = new TypedViewerFilter(acceptedClasses);

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

    IPath initialPath = new Path(exclPatternDialog.getText());
    IResource initialElement = null;
    IContainer curr = currSourceFolder;
    int nSegments = initialPath.segmentCount();
    for (int i = 0; i < nSegments; i++) {
        IResource elem = curr.findMember(initialPath.segment(i));
        if (elem != null) {
            initialElement = elem;
        }
        if (elem instanceof IContainer) {
            curr = (IContainer) elem;
        } else {
            break;
        }
    }
    String title, message;
    if (isExclusion) {
        title = "Exclusion Pattern Selection";
        message = "&Choose a folder or file to exclude:";
    } else {
        title = "Inclusion Pattern Selection";
        message = "&Choose a folder or file 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(initialElement);
    dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));

    if (dialog.open() == Window.OK) {
        IResource res = (IResource) dialog.getFirstResult();
        IPath path = res.getFullPath().removeFirstSegments(
                currSourceFolder.getFullPath().segmentCount())
                .makeRelative();
        if (res instanceof IContainer) {
            return path.addTrailingSeparator();
        }
        return path;
    }
    return null;
}
 
開發者ID:iloveeclipse,項目名稱:filesync4eclipse,代碼行數:56,代碼來源:InclusionExclusionEntryDialog.java


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