• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ListDialog类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.ui.dialogs.ListDialog的典型用法代码示例。如果您正苦于以下问题:Java ListDialog类的具体用法?Java ListDialog怎么用?Java ListDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: openDialog

import org.eclipse.ui.dialogs.ListDialog; //导入依赖的package包/类
private ICoverageLaunch openDialog(ExecutionEvent event,
    List<ICoverageLaunch> launches) {
  final ListDialog dialog = new ListDialog(HandlerUtil.getActiveShell(event)) {
    @Override
    protected void configureShell(Shell shell) {
      super.configureShell(shell);
      ContextHelp.setHelp(shell, ContextHelp.DUMP_EXECUTION_DATA);
    }
  };
  dialog.setTitle(UIMessages.DumpExecutionDataDialog_title);
  dialog.setMessage(UIMessages.DumpExecutionDataDialog_message);
  dialog.setContentProvider(ArrayContentProvider.getInstance());
  dialog.setLabelProvider(new LaunchLabelProvider());
  dialog.setInput(launches);
  if (dialog.open() == Dialog.OK && dialog.getResult().length == 1) {
    return (ICoverageLaunch) dialog.getResult()[0];
  }
  return null;
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:20,代码来源:DumpExecutionDataHandler.java


示例2: execute

import org.eclipse.ui.dialogs.ListDialog; //导入依赖的package包/类
public Object execute(ExecutionEvent event) throws ExecutionException {
	Shell activeShell = HandlerUtil.getActiveShell(event);
	ListDialog searchDialog = createSearchDialog(event, activeShell, searchEngine);
	int result = searchDialog.open();
	if (result == Window.OK) {
		try {
			Object[] selections = searchDialog.getResult();
			if (selections != null && selections.length > 0) {
				Object selection = selections[0];
				if (selection instanceof IEObjectDescription) {
					IEObjectDescription selectedObjectDescription = (IEObjectDescription) selection;
					uriEditorOpener.open(selectedObjectDescription.getEObjectURI(), true);
				}
			}
		} catch (Exception e) {
			LOG.error("Error opening editor", e);
			throw new ExecutionException("Error opening editor", e);
		}
	}
	return null;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:22,代码来源:OpenXtextElementHandler.java


示例3: createQueryRunnable

import org.eclipse.ui.dialogs.ListDialog; //导入依赖的package包/类
private Runnable createQueryRunnable(final String question, final Object[] elements, final int[] result) {
	return new Runnable() {
		public void run() {
			ListDialog dialog= new YesNoListDialog(fShell, true);
			dialog.setAddCancelButton(false);
			dialog.setBlockOnOpen(true);
			dialog.setContentProvider(new ArrayContentProvider());
			dialog.setLabelProvider(new JavaElementLabelProvider());
			dialog.setTitle(fDialogTitle);
			dialog.setMessage(question);
			dialog.setInput(elements);

			dialog.open();
			result[0]= dialog.getReturnCode();
		}
	};
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:18,代码来源:ReorgQueries.java


示例4: showSaveDirtyFileDialog

import org.eclipse.ui.dialogs.ListDialog; //导入依赖的package包/类
private static boolean showSaveDirtyFileDialog(
		List<IEditorPart> dirtyEditors )
{
	AdaptableList input = new AdaptableList( dirtyEditors );

	ListDialog dlg = new ListDialog( PlatformUI.getWorkbench( )
			.getActiveWorkbenchWindow( )
			.getShell( ) );
	dlg.setContentProvider( new BaseWorkbenchContentProvider( ) );
	dlg.setLabelProvider( new WorkbenchPartLabelProvider( ) );
	dlg.setInput( input );
	dlg.setMessage( Messages.getString( "renameChecker.saveResourcesMessage" ) ); //$NON-NLS-1$
	dlg.setTitle( Messages.getString( "renameChecker.saveResourcesTitle" ) ); //$NON-NLS-1$

	// Just return false to prevent the operation continuing
	return dlg.open( ) == IDialogConstants.OK_ID;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:18,代码来源:ResourceCloseManagement.java


示例5: chooseOneString

import org.eclipse.ui.dialogs.ListDialog; //导入依赖的package包/类
/**
 * Let the user choose one of a list of Strings
 * @param title title of the dialog
 * @param targetPart IWorkBenchPart to call this from
 * @param choices Vector of Strings to choose from
 * @return index of the choice; or -1 if the user cancelled
 */
public static int chooseOneString(String title, IWorkbenchPart targetPart, Vector<String> choices)
{
	int pos = -1;
	ListDialog listDialog = new ListDialog(targetPart.getSite().getShell()); 
	listDialog.setContentProvider(new ArrayContentProvider());
	listDialog.setLabelProvider(new LabelProvider());
	listDialog.setTitle(title);
	listDialog.setInput(choices.toArray());
	listDialog.open();
	if (listDialog.getReturnCode()== ListDialog.CANCEL) return pos;
	try
	{
		String chosen = (String)(listDialog.getResult()[0]);
		for (int i = 0; i < choices.size(); i++) if (choices.get(i).equals(chosen)) pos = i;			
	}
	catch (Exception ex)
	{
		showMessage("Error","You must choose a root class for the EMF Ecore instance");
	}
	return pos;
}
 
开发者ID:openmapsoftware,项目名称:mappingtools,代码行数:29,代码来源:WorkBenchUtil.java


示例6: pickAvroSchemaEditorFromEditorParts

import org.eclipse.ui.dialogs.ListDialog; //导入依赖的package包/类
public static AvroSchemaEditor pickAvroSchemaEditorFromEditorParts() {
  	
  	AvroSchemaEditor editor = null;
  	
  	List<IEditorReference> schemaEditorRefList = new ArrayList<>();

IEditorReference[] editorReferences = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences();
for (IEditorReference editorRef : editorReferences) {
	IEditorPart editorPart = editorRef.getEditor(false);
	if (editorPart != null && editorPart instanceof IWithAvroSchemaEditor) {
		schemaEditorRefList.add(editorRef);
	}
}

if (schemaEditorRefList.size() == 1) {
	editor = ((IWithAvroSchemaEditor) schemaEditorRefList.get(0).getEditor(false)).getEditor();
} else if (schemaEditorRefList.size() > 1) {
	// we have to ask the user to choose an editor
	// with a dialog
	ListDialog dialog = new ListDialog(Display.getCurrent().getActiveShell());
	dialog.setLabelProvider(new LabelProvider() {				
		@Override
		public String getText(Object element) {
			return ((IEditorReference) element).getPartName();
		}
	});
	dialog.setContentProvider(new ArrayContentProvider());
	dialog.setInput(schemaEditorRefList);
	int result = dialog.open();
	if (result == ListDialog.OK) {
		Object[] selectedEditor = dialog.getResult();
		IEditorReference selectedEditorRef = (IEditorReference) selectedEditor[0];
		editor = ((IWithAvroSchemaEditor) selectedEditorRef.getEditor(false)).getEditor();
	}
}		
  	
return editor;

  }
 
开发者ID:Talend,项目名称:avro-schema-editor,代码行数:40,代码来源:UIUtils.java


示例7: widgetSelected

import org.eclipse.ui.dialogs.ListDialog; //导入依赖的package包/类
@Override
public void widgetSelected(SelectionEvent event) {
	IConfigurationElement[] importerElements = Platform.getExtensionRegistry()
			.getConfigurationElementsFor(EMM_IMPORTER_EXTID);

	// We only give the choice to the user if there are 2+ importers
	Object[] selected = importerElements;
	if (importerElements.length > 1) {
		final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
		final ListDialog lstDialog = new ListDialog(shell);
		lstDialog.setContentProvider(new ArrayContentProvider());
		lstDialog.setLabelProvider(new LabelProvider() {
			@Override
			public String getText(Object element) {
				return ((IConfigurationElement) element).getDeclaringExtension().getLabel();
			}
		});
		lstDialog.setInput(importerElements);
		lstDialog.setTitle("Select an importer");
		if (lstDialog.open() == Window.OK) {
			selected = lstDialog.getResult();
		} else {
			selected = new Object[0];
		}
	}

	if (selected.length > 0) {
		final IConfigurationElement selectedCE = (IConfigurationElement) selected[0];
		try {
			final EMMImporter importer = (EMMImporter) selectedCE.createExecutableExtension("class");
			importer.importEffectiveMetamodelInto(store);
			setEffectiveMetamodel(store);
			treeViewer.refresh();
			getEditor().setDirty(true);
		} catch (CoreException ex) {
			Activator.getDefault().logError(ex);
		}
	}
}
 
开发者ID:mondo-project,项目名称:mondo-integration,代码行数:40,代码来源:EffectiveMetamodelFormPage.java


示例8: widgetSelected

import org.eclipse.ui.dialogs.ListDialog; //导入依赖的package包/类
@Override
public void widgetSelected(SelectionEvent e) {
	ListDialog dialog = new ListDialog(getShell());
	WorkbenchContentProvider contentProvider = new WorkbenchContentProvider();
	dialog.setContentProvider(contentProvider);
	dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
	dialog.setLabelProvider(new WorkbenchLabelProvider());
	dialog.setTitle("Select Project");
	dialog.setMessage("Select Project:");
	if (dialog.open() == Window.OK && dialog.getResult().length == 1) {
		IProject selectedProject = (IProject) dialog.getResult()[0];
		project.setText(selectedProject.getName());
	}
}
 
开发者ID:RichardBirenheide,项目名称:brainfuck,代码行数:15,代码来源:BfMainTab.java


示例9: askSaveAllDirtyEditors

import org.eclipse.ui.dialogs.ListDialog; //导入依赖的package包/类
private boolean askSaveAllDirtyEditors(Shell shell, IEditorPart[] dirtyEditors) {
	final boolean canSaveAutomatically= fSaveMode != SAVE_ALL_ALWAYS_ASK;
	if (canSaveAutomatically && RefactoringSavePreferences.getSaveAllEditors()) //must save everything
		return true;
	ListDialog dialog= new ListDialog(shell) {
		{
			setShellStyle(getShellStyle() | SWT.APPLICATION_MODAL);
		}
		@Override
		protected Control createDialogArea(Composite parent) {
			Composite result= (Composite) super.createDialogArea(parent);
			if (canSaveAutomatically) {
				final Button check= new Button(result, SWT.CHECK);
				check.setText(RefactoringMessages.RefactoringStarter_always_save);
				check.setSelection(RefactoringSavePreferences.getSaveAllEditors());
				check.addSelectionListener(new SelectionAdapter() {
					@Override
					public void widgetSelected(SelectionEvent e) {
						RefactoringSavePreferences.setSaveAllEditors(check.getSelection());
					}
				});
				applyDialogFont(result);
			}
			return result;
		}
	};
	dialog.setTitle(RefactoringMessages.RefactoringStarter_save_all_resources);
	dialog.setAddCancelButton(true);
	dialog.setLabelProvider(createDialogLabelProvider());
	dialog.setMessage(RefactoringMessages.RefactoringStarter_must_save);
	dialog.setContentProvider(new ArrayContentProvider());
	dialog.setInput(Arrays.asList(dirtyEditors));
	return dialog.open() == Window.OK;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:35,代码来源:RefactoringSaveHelper.java


示例10: askSaveAllDirtyEditors

import org.eclipse.ui.dialogs.ListDialog; //导入依赖的package包/类
private boolean askSaveAllDirtyEditors(Shell shell, IEditorPart[] dirtyEditors) {
	final boolean canSaveAutomatically= fSaveMode != SAVE_ALL_ALWAYS_ASK;
	if (canSaveAutomatically && RefactoringSavePreferences.getSaveAllEditors()) //must save everything
		return true;
	ListDialog dialog= new ListDialog(shell) {
		{
			setShellStyle(getShellStyle() | SWT.APPLICATION_MODAL);
		}
		@Override
		protected Control createDialogArea(Composite parent) {
			Composite result= (Composite) super.createDialogArea(parent);
			if (canSaveAutomatically) {
				final Button check= new Button(result, SWT.CHECK);
				check.setText(RefactoringMessages.RefactoringStarter_always_save);
				check.setSelection(RefactoringSavePreferences.getSaveAllEditors());
				check.addSelectionListener(new SelectionAdapter() {
					@Override
					public void widgetSelected(SelectionEvent e) {
						RefactoringSavePreferences.setSaveAllEditors(check.getSelection());
					}
				});
				applyDialogFont(result);
			}
			return result;
		}
	};
	dialog.setTitle(RefactoringMessages.RefactoringStarter_save_all_resources);
	dialog.setLabelProvider(createDialogLabelProvider());
	dialog.setMessage(RefactoringMessages.RefactoringStarter_must_save);
	dialog.setContentProvider(new ArrayContentProvider());
	dialog.setInput(Arrays.asList(dirtyEditors));
	return dialog.open() == Window.OK;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:34,代码来源:RefactoringSaveHelper.java


示例11: openProjectSettings

import org.eclipse.ui.dialogs.ListDialog; //导入依赖的package包/类
void openProjectSettings() {
	ListDialog dialog = new ListDialog(getShell()) {

		protected Control createDialogArea(Composite container) {
			Control area = super.createDialogArea(container);
			getTableViewer().setSorter(new ResourceSorter(ResourceSorter.NAME));
			return area;
		}
	};
	dialog.setMessage(SSEUIMessages.PropertyPreferencePage_02);
	dialog.setContentProvider(new IStructuredContentProvider() {
		public void dispose() {
		}

		public Object[] getElements(Object inputElement) {
			return ((IWorkspace) inputElement).getRoot().getProjects();
		}

		public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
		}
	});
	dialog.setLabelProvider(new DecoratingLabelProvider(new WorkbenchLabelProvider(), SSEUIPlugin.getDefault().getWorkbench().getDecoratorManager().getLabelDecorator()));
	dialog.setInput(ResourcesPlugin.getWorkspace());
	dialog.setTitle(SSEUIMessages.PropertyPreferencePage_01);
	if (dialog.open() == Window.OK) {
		Object[] result = dialog.getResult();
		if (result.length > 0) {
			IProject project = (IProject) dialog.getResult()[0];
			Map data = new HashMap();
			data.put(DISABLE_LINK, Boolean.TRUE);
			PreferencesUtil.createPropertyDialogOn(getShell(), project, getPropertyPageID(), new String[]{getPropertyPageID()}, data).open();
		}
	}
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-webresources,代码行数:35,代码来源:PropertyPreferencePage.java


示例12: selectProjectEntryByDialog

import org.eclipse.ui.dialogs.ListDialog; //导入依赖的package包/类
private IPath selectProjectEntryByDialog(final List<IPath> paths) {
    final AtomicReference<IPath> selectionResult = new AtomicReference<>();
    Activator.getDisplay().syncExec(new Runnable() {
        @Override
        public void run() {
            ListDialog dialog = new ListDialog(getShell()) {
                @Override
                protected int getTableStyle() {
                    return super.getTableStyle() | SWT.SINGLE;
                }
            };
            dialog.setTitle(Messages.NewProjectWizard_selectEntryTitle);
            dialog.setMessage(Messages.NewProjectWizard_selectEntryMessage);
            dialog.setInitialSelections(new Object[] { paths.get(0) });
            dialog.setInput(paths);
            dialog.setContentProvider(ArrayContentProvider.getInstance());
            dialog.setLabelProvider(new ShortenLabelProvider(paths));
            if (dialog.open() != Window.OK) {
                return;
            }
            Object[] selected = dialog.getResult();
            if (selected.length >= 1) {
                selectionResult.set((IPath) selected[0]);
            }
        }
    });
    return selectionResult.get();
}
 
开发者ID:asakusafw,项目名称:asakusafw-shafu,代码行数:29,代码来源:NewProjectWizard.java


示例13: addVariables

import org.eclipse.ui.dialogs.ListDialog; //导入依赖的package包/类
private void addVariables(Text target, Map bindings) {

        final List variables = new ArrayList(bindings.size());

        ILabelProvider labelProvider = new LabelProvider() {
            public String getText(Object element) {
                return ((StringPair) element).s1
                        + " - " + ((StringPair) element).s2; //$NON-NLS-1$
            }
        };

        IStructuredContentProvider contentsProvider = new IStructuredContentProvider() {
            public Object[] getElements(Object inputElement) {
                return variables.toArray(new StringPair[variables.size()]);
            }

            public void dispose() {
            }

            public void inputChanged(Viewer viewer, Object oldInput,
                    Object newInput) {
            }
        };

        for (Iterator it = bindings.keySet().iterator(); it.hasNext();) {
            StringPair variable = new StringPair();
            variable.s1 = (String) it.next(); // variable
            variable.s2 = (String) bindings.get(variable.s1); // description
            variables.add(variable);
        }

        ListDialog dialog = new ListDialog(this.getShell());
        dialog.setContentProvider(contentsProvider);
        dialog.setAddCancelButton(true);
        dialog.setLabelProvider(labelProvider);
        dialog.setInput(variables);
        dialog.setTitle(Policy
                .bind("DiffMergePreferencePage.addVariableDialogTitle")); //$NON-NLS-1$
        if (dialog.open() != ListDialog.OK)
            return;

        Object[] result = dialog.getResult();

        for (int i = 0; i < result.length; i++) {
            target.insert("${" + ((StringPair) result[i]).s1 + "}"); //$NON-NLS-1$ //$NON-NLS-2$
        }
    }
 
开发者ID:subclipse,项目名称:subclipse,代码行数:48,代码来源:NewMergeFileAssociationWizardPage.java


示例14: addVariables

import org.eclipse.ui.dialogs.ListDialog; //导入依赖的package包/类
/**
 * Add another variable to the given target. The variable is inserted at
 * current position A ListSelectionDialog is shown and the choose the
 * variables to add
 */
private void addVariables(Text target, Map bindings) {

    final List variables = new ArrayList(bindings.size());

    ILabelProvider labelProvider = new LabelProvider() {
        public String getText(Object element) {
            return ((StringPair) element).s1
                    + " - " + ((StringPair) element).s2; //$NON-NLS-1$
        }
    };

    IStructuredContentProvider contentsProvider = new IStructuredContentProvider() {
        public Object[] getElements(Object inputElement) {
            return variables.toArray(new StringPair[variables.size()]);
        }

        public void dispose() {
        }

        public void inputChanged(Viewer viewer, Object oldInput,
                Object newInput) {
        }
    };

    for (Iterator it = bindings.keySet().iterator(); it.hasNext();) {
        StringPair variable = new StringPair();
        variable.s1 = (String) it.next(); // variable
        variable.s2 = (String) bindings.get(variable.s1); // description
        variables.add(variable);
    }

    ListDialog dialog = new ListDialog(this.getShell());
    dialog.setContentProvider(contentsProvider);
    dialog.setAddCancelButton(true);
    dialog.setLabelProvider(labelProvider);
    dialog.setInput(variables);
    dialog.setTitle(Policy
            .bind("DiffMergePreferencePage.addVariableDialogTitle")); //$NON-NLS-1$
    if (dialog.open() != ListDialog.OK)
        return;

    Object[] result = dialog.getResult();

    for (int i = 0; i < result.length; i++) {
        target.insert("${" + ((StringPair) result[i]).s1 + "}"); //$NON-NLS-1$ //$NON-NLS-2$
    }
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:53,代码来源:DiffMergePreferencePage.java


示例15: openLibraryApplicationDialog

import org.eclipse.ui.dialogs.ListDialog; //导入依赖的package包/类
/**
 * 라이브러리 적용하는 다이얼로그 여는 메소드 void
 */
protected void openLibraryApplicationDialog() {
    ListDialog libraryApplicationDialog = new ListDialog(getShell());

    libraryApplicationDialog.setAddCancelButton(true);
    libraryApplicationDialog.setContentProvider(new ArrayContentProvider());
    libraryApplicationDialog.setLabelProvider(new LabelProvider() {
        /**
         * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
         */
        @Override
        public String getText(Object element) {
            if (element instanceof Package) {
                return ((Package) element).getName();
            }

            return UICoreConstant.PROJECT_CONSTANTS__EMPTY_STRING;
        }
    });

    initializeApplicableLibraryList();

    libraryApplicationDialog.setInput(applicableLibraryList.toArray());
    libraryApplicationDialog.setInitialSelections(applicableLibraryList.toArray());
    libraryApplicationDialog.setTitle(UMLMessage.LABEL_LIBRARY_APPLICATION);

    if (libraryApplicationDialog.open() == Window.OK) {
        Object[] libraries = libraryApplicationDialog.getResult();

        Package newLibrary = (Package) libraries[0];

        applyingLibraryList.add(newLibrary);

        // RecordingCommand command = new
        // HandleImportedPackageCommand(DomainRegistry.getEditingDomain(),
        // model, newLibrary, true);
        // DomainUtil.executeCommand(command);

        libraryTableViewer.setInput(applyingLibraryList.toArray());
        libraryTableViewer.refresh();

        apply();
        
        callerSection.isDirty();
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:49,代码来源:LibraryComposite.java


示例16: createSearchDialog

import org.eclipse.ui.dialogs.ListDialog; //导入依赖的package包/类
protected ListDialog createSearchDialog(ExecutionEvent event, Shell activeShell, IXtextEObjectSearch searchEngine) {
	return new XtextEObjectSearchDialog(activeShell, searchEngine, globalDescriptionLabelProvider, isEnableStyledLabels());
}
 
开发者ID:cplutte,项目名称:bts,代码行数:4,代码来源:OpenXtextElementHandler.java


示例17: doRun

import org.eclipse.ui.dialogs.ListDialog; //导入依赖的package包/类
@Override
public ESPrimaryVersionSpec doRun(IProgressMonitor monitor)
	throws ESException {
	final ESRangeQuery query = ESHistoryQuery.FACTORY.rangeQuery(
		projectSpace.getBaseVersion(), 20, 0, false, false, false,
		false);
	final List<ESHistoryInfo> historyInfo = projectSpace.getHistoryInfos(query, new NullProgressMonitor());
	// filter base version
	final Iterator<ESHistoryInfo> iter = historyInfo.iterator();
	while (iter.hasNext()) {
		if (projectSpace.getBaseVersion().equals(iter.next().getPrimarySpec())) {
			iter.remove();
			break;
		}
	}
	if (historyInfo.size() == 0) {
		return new UIUpdateProjectController(
			getShell(),
			projectSpace,
			ESVersionSpec.FACTORY.createHEAD(projectSpace.getBaseVersion()))
			.execute();
	}

	final ListDialog listDialog = createDialog(historyInfo);
	final Integer result = RunInUI.runWithResult(new Callable<Integer>() {
		public Integer call() throws Exception {
			return listDialog.open();
		}
	});

	if (Window.OK == result) {
		final Object[] selection = listDialog.getResult();
		final ESHistoryInfo info = (ESHistoryInfo) selection[0];
		return RunInUI.WithException.runWithResult(new Callable<ESPrimaryVersionSpec>() {
			public ESPrimaryVersionSpec call() throws Exception {
				final UIUpdateProjectController controller = new UIUpdateProjectController(
					getShell(),
					projectSpace,
					ESVersionSpec.FACTORY.createPRIMARY(
						info.getPrimarySpec().getIdentifier()));
				return controller.execute();
			}
		});
	}
	return null;
}
 
开发者ID:edgarmueller,项目名称:emfstore-rest,代码行数:47,代码来源:UIUpdateProjectToVersionController.java


示例18: restoreInterpreterInfos

import org.eclipse.ui.dialogs.ListDialog; //导入依赖的package包/类
/**
 * Restores the modules. Is called when the user changed something in the editor and applies the change.
 *
 * Gathers all the info and calls the hook that really restores things within a thread, so that the user can
 * get information on the progress.
 *
 * Only the information on the default interpreter is stored.
 *
 * @param editorChanged whether the editor was changed (if it wasn't, we'll ask the user what to restore).
 * @return true if the info was restored and false otherwise.
 */
protected void restoreInterpreterInfos(boolean editorChanged) {
    final Set<String> interpreterNamesToRestore = pathEditor.getInterpreterExeOrJarToRestoreAndClear();
    final IInterpreterInfo[] exesList = pathEditor.getExesList();

    if (!editorChanged && interpreterNamesToRestore.size() == 0) {
        IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
        SelectionDialog listDialog = createChooseIntepreterInfoDialog(workbenchWindow, exesList,
                "Select interpreters to be restored", true);

        int open = listDialog.open();
        if (open != ListDialog.OK) {
            return;
        }
        Object[] result = listDialog.getResult();
        if (result == null || result.length == 0) {
            return;

        }
        for (Object o : result) {
            interpreterNamesToRestore.add(((IInterpreterInfo) o).getExecutableOrJar());
        }

    }

    //this is the default interpreter
    ProgressMonitorDialog monitorDialog = new AsynchronousProgressMonitorDialog(this.getShell());
    monitorDialog.setBlockOnOpen(false);

    try {
        IRunnableWithProgress operation = new IRunnableWithProgress() {

            @Override
            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                monitor.beginTask("Restoring PYTHONPATH", IProgressMonitor.UNKNOWN);
                try {
                    pathEditor.pushExpectedSetInfos();
                    //clear all but the ones that appear
                    getInterpreterManager().setInfos(exesList, interpreterNamesToRestore, monitor);
                } finally {
                    pathEditor.popExpectedSetInfos();
                    monitor.done();
                }
            }
        };

        monitorDialog.run(true, true, operation);

    } catch (Exception e) {
        Log.log(e);
    }
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:63,代码来源:AbstractInterpreterPreferencesPage.java


示例19: selectAttachment

import org.eclipse.ui.dialogs.ListDialog; //导入依赖的package包/类
/**
 * Selects the attachment.
 * 
 * @param parent
 *            the parent shell.
 * @param currentAttachment
 *            the original attachment.
 * @param basicNode
 *            the node.
 * @return the selected attachment.
 * 
 * @see net.dependableos.dcase.diagram.ui.AttributeDialog.IAttachmentSelector#selectAttachment(java.lang.String)
 */
public String selectAttachment(Shell parent, String currentAttachment,
		BasicNode basicNode) {
	if (basicNode instanceof Goal || basicNode instanceof Userdef005 ||
			basicNode instanceof Userdef001) {
		ListDialog dialog = new ListDialog(parent);
		dialog.setTitle("Select from Modules..."); //$NON-NLS-1$
		dialog.setMessage("Select from the following Modules..."); //$NON-NLS-1$
		dialog.setContentProvider(new ArrayContentProvider());
		dialog.setLabelProvider(new LabelProvider());

		// get data
		argumentEditPart = DcaseEditorUtil.getCurrentArgumentEditPart();
		boolean isGoalNode = (basicNode instanceof Goal);
		ArrayList<String> data = new ArrayList<String>();
		Map<String, String> map = null;
		try {
			map = ModuleUtil.getModulesAndNodes(argumentEditPart,
					isGoalNode);
		} catch (CoreException e) {
			MessageWriter.writeMessageToConsole(
					Messages.SelectModuleContributionItem_0,
					MessageTypeImpl.SELECT_MODULE_FAILED);
			return null;
		}
		IFile modelFile = DcaseEditorUtil.getModelFile(argumentEditPart);
		String moduleName = ModuleUtil.getModuleName(modelFile);
		for (Map.Entry<String, String> entry : map.entrySet()) {
			String name = entry.getKey();
			if (moduleName.equals(ModuleUtil.getModuleName(name))) {
				continue;
			}
			if (isGoalNode && !ModuleUtil.isPublicNodeName(name)) {
				continue;
			}
			data.add(name);
		}
		dialog.setInput(data.toArray());

		if (dialog.open() == ListDialog.OK) {
			Object[] result = dialog.getResult();
			if (result.length == 1) {
				return (String) result[0];
			}
		}
	}

	return null;
}
 
开发者ID:d-case,项目名称:d-case_editor,代码行数:62,代码来源:SelectModuleContributionItem.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FontManagerNativeLibrary类代码示例发布时间:2022-05-21
下一篇:
Java INpc类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap