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


Java SelectionDialog.OK属性代码示例

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


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

示例1: handleManifestmainclassBrowse

/**
 * Uses the standard container selection dialog to
 * choose the new value for the container field.
 */

private void handleManifestmainclassBrowse() {

    String mainClass = getManifestmainclass();
    
    ILabelProvider lp= new WorkbenchLabelProvider();
    ITreeContentProvider cp= new WorkbenchContentProvider();

    IResource[] res=jproject.getResource();
    IJavaSearchScope searchScope= JavaSearchScopeFactory.getInstance().createJavaSearchScope(res, true);
    SelectionDialog dialog = JavaUI.createMainTypeDialog(getShell(), getContainer(), searchScope, 0, false);
    dialog.setMessage("Select Main-Class for JAR file");
    dialog.setTitle("Fat Jar Config");
    
    if (dialog.open() == SelectionDialog.OK) {
        Object[] elements= dialog.getResult();
        if (elements.length == 1) {
            SourceType mainElement = (SourceType)elements[0];
            mainClass = mainElement.getFullyQualifiedName();
            manifestmainclassText.setText(mainClass);
        }
    }
}
 
开发者ID:thahn0720,项目名称:agui_eclipse_plugin,代码行数:27,代码来源:ConfigPage.java

示例2: handleManifestmainclassBrowse

/**
 * Uses the standard container selection dialog to choose the new value for
 * the container field.
 */

private void handleManifestmainclassBrowse() {
	try {
		String mainClass = getManifestmainclass();

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

		IResource[] res = { jproject.getCorrespondingResource() };
		IJavaSearchScope searchScope = JavaSearchScopeFactory.getInstance().createJavaSearchScope(res, true);
		SelectionDialog dialog = JavaUI.createMainTypeDialog(getShell(), getContainer(), searchScope, 0, false);
		dialog.setMessage("Select Main-Class for JAR file");
		dialog.setTitle("Fat Jar Config");

		if (dialog.open() == SelectionDialog.OK) {
			Object[] elements = dialog.getResult();
			if (elements.length == 1) {
				SourceType mainElement = (SourceType) elements[0];
				mainClass = mainElement.getFullyQualifiedName();
				manifestmainclassText.setText(mainClass);
			}
		}
	} catch (JavaModelException e) {
		e.printStackTrace();
	}
}
 
开发者ID:thahn0720,项目名称:agui_eclipse_plugin,代码行数:30,代码来源:FJExportWizardConfigPage.java

示例3: searchForClass

private void searchForClass() {
    OpenTypeSelectionDialog dialog = new OpenTypeSelectionDialog(
            getShell(), true, null, null, IJavaSearchConstants.CLASS);
    dialog.setTitle("Search for checker classes");
    dialog.setMessage("Select additional checkers to use.");

    if (dialog.open() == SelectionDialog.OK) {
        Object[] results = dialog.getResult();
        Set<String> classNames = new LinkedHashSet<String>();

        for (Object result : results) {
            if (result instanceof IType) {
                IType type = (IType) result;
                classNames.add(type.getFullyQualifiedName());
            }
        }

        //TODO: CHECK FOR DUPLICATES?

        final List<String> classesInTable = classesFromTableItems();
        for(final String cn : classNames) {
            final CheckerInfo ci = CheckerInfo.fromClassPath(cn, null);
            if(!classesInTable.contains(cn)) { //TODO: ADD A DIALOG TO WARN IF ALREADY CONTAINED
                addProcTableItem(ci, false);
            }
        }
    }
}
 
开发者ID:reprogrammer,项目名称:checker-framework,代码行数:28,代码来源:CheckerPreferencePage.java

示例4: addOption

private void addOption() {
    final InputDialog inputDialog = new InputDialog( getShell(), "Add Option",
            "Please enter your option exactly as it would appear on the command line. " +
            "Include any space that would appear between the option name and value.",
            "",
            null);

    if (inputDialog.open() == SelectionDialog.OK) {
        final String result = inputDialog.getValue();
        addOptTableItem(new OptionLine(result, true));
    }
}
 
开发者ID:reprogrammer,项目名称:checker-framework,代码行数:12,代码来源:CheckerPreferencePage.java

示例5: searchForClass

private void searchForClass()
{
    OpenTypeSelectionDialog dialog = new OpenTypeSelectionDialog(
            getShell(), true, null, null, IJavaSearchConstants.CLASS);
    dialog.setTitle("Search for checker classes");
    dialog.setMessage("Select additional checkers to use.");

    if (dialog.open() == SelectionDialog.OK)
    {
        Object[] results = dialog.getResult();
        List<String> classNames = new ArrayList<String>();

        for (Object result : results)
        {
            if (result instanceof IType)
            {
                IType type = (IType) result;
                classNames.add(type.getFullyQualifiedName());
            }
        }
        
        for(final String cn : classNames) { 
        	if(!contains(cn)) { //TODO: ADD A DIALOG TO WARN IF ALREADY CONTAINED
        	    customCheckers.add(cn);
        	}
        }
    }
}
 
开发者ID:reprogrammer,项目名称:checker-framework,代码行数:28,代码来源:CustomPreferencesPage.java

示例6: openDialogBox

protected Object openDialogBox( Control cellEditorWindow )
{
	TimeOptionDialog dialog = new TimeOptionDialog( cellEditorWindow.getShell( ) );
	Object value =  getValue( );
	Date dateValue = new Date( );
	try {
		if ( value != null )
		{
			TimeDialogInfo time = new TimeDialogInfo( );
			if( value instanceof String && !value.toString().trim().equals("") ) //$NON-NLS-1$
			{
				dateValue  = new SimpleDateFormat( time.getFormat()).parse(value.toString() );
			}
			else if( value instanceof Date )
			{
				dateValue  = (Date)value;
			}
			time.setTime( dateValue.getTime( ) );
			dialog.setInfo( time );
		}
	} catch ( Exception e ) {
		logger.log(Level.SEVERE, e.getMessage(),e);
	}
	
	dialog.open( );
	if ( dialog.getReturnCode( ) == SelectionDialog.OK )
	{
		TimeDialogInfo result = ( TimeDialogInfo ) dialog.getInfo( );
		dateValue = new Date( result.getTime( ) );
	}
	return dateValue;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:32,代码来源:DateTimeCellEditor.java

示例7: select

/**
 * Selects a list of strings from a list of strings
 * 
 * @param history the history that may be selected for execution
 * @return null if none was selected or a list of strings with the commands to be executed
 */
public static List<String> select(final ScriptConsoleHistory history) {

    //created the HistoryElementListSelectionDialog instead of using the ElementListSelectionDialog directly because:
    //1. No sorting should be enabled for choosing the history
    //2. The last element should be the one selected by default
    //3. The list should be below the commands
    //4. The up arrow should be the one used to get focus in the elements
    HistoryElementListSelectionDialog dialog = new HistoryElementListSelectionDialog(Display.getDefault()
            .getActiveShell(), getLabelProvider()) {
        private static final int CLEAR_HISTORY_ID = IDialogConstants.CLIENT_ID + 1;

        @Override
        protected void createButtonsForButtonBar(Composite parent) {
            super.createButtonsForButtonBar(parent);
            createButton(parent, CLEAR_HISTORY_ID, "Clear History", false); //$NON-NLS-1$
        }

        @Override
        protected void buttonPressed(int buttonId) {
            if (buttonId == CLEAR_HISTORY_ID) {
                history.clear();

                // After deleting the history, close the dialog with a cancel return code
                cancelPressed();
            }
            super.buttonPressed(buttonId);
        }
    };

    dialog.setTitle("Command history");
    final List<String> selectFrom = history.getAsList();
    dialog.setElements(selectFrom.toArray(new String[0]));
    dialog.setEmptySelectionMessage("No command selected");
    dialog.setAllowDuplicates(true);
    dialog.setBlockOnOpen(true);
    dialog.setSize(100, 25); //in number of chars
    dialog.setMessage("Select command(s) to be executed");
    dialog.setMultipleSelection(true);

    if (dialog.open() == SelectionDialog.OK) {
        Object[] result = dialog.getResult();
        if (result != null) {
            ArrayList<String> list = new ArrayList<String>();
            for (Object o : result) {
                list.add(o.toString());
            }
            return list;
        }
    }
    return null;
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:57,代码来源:ScriptConsoleHistorySelector.java


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