本文整理汇总了Java中org.eclipse.ui.dialogs.ListSelectionDialog类的典型用法代码示例。如果您正苦于以下问题:Java ListSelectionDialog类的具体用法?Java ListSelectionDialog怎么用?Java ListSelectionDialog使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ListSelectionDialog类属于org.eclipse.ui.dialogs包,在下文中一共展示了ListSelectionDialog类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: clearHistory
import org.eclipse.ui.dialogs.ListSelectionDialog; //导入依赖的package包/类
private void clearHistory(BuildJob[] buildJobs, BuildJob[] selectedJobs) {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
ListSelectionDialog dialog = new ListSelectionDialog(shell, buildJobs, ArrayContentProvider.getInstance(),
new BuildJobLabelProvider(), "Select Doxyfiles you want to remove from history");
dialog.setTitle("Clear History");
if ((selectedJobs != null) && (selectedJobs.length > 0)) {
dialog.setInitialSelections(selectedJobs);
}
if (dialog.open() == Window.OK) {
Object[] result = dialog.getResult();
if (result.length > 0) {
BuildJob[] clearJobs = new BuildJob[result.length];
System.arraycopy(result, 0, clearJobs, 0, result.length);
Plugin.getDefault().getBuildManager().removeAll(clearJobs);
}
}
}
示例2: addProjectDialog
import org.eclipse.ui.dialogs.ListSelectionDialog; //导入依赖的package包/类
private CPListElement[] addProjectDialog() {
try {
Object[] selectArr= getNotYetRequiredProjects();
new JavaElementComparator().sort(null, selectArr);
ListSelectionDialog dialog= new ListSelectionDialog(getShell(), Arrays.asList(selectArr), new ArrayContentProvider(), new JavaUILabelProvider(), NewWizardMessages.ProjectsWorkbookPage_chooseProjects_message);
dialog.setTitle(NewWizardMessages.ProjectsWorkbookPage_chooseProjects_title);
dialog.setHelpAvailable(false);
if (dialog.open() == Window.OK) {
Object[] result= dialog.getResult();
CPListElement[] cpElements= new CPListElement[result.length];
for (int i= 0; i < result.length; i++) {
IJavaProject curr= (IJavaProject) result[i];
cpElements[i]= new CPListElement(fCurrJProject, IClasspathEntry.CPE_PROJECT, curr.getPath(), curr.getResource());
}
return cpElements;
}
} catch (JavaModelException e) {
return null;
}
return null;
}
示例3: FilesChangedListDialog
import org.eclipse.ui.dialogs.ListSelectionDialog; //导入依赖的package包/类
public FilesChangedListDialog(Shell shell, Set<ChangedFile> differences, Git git, IJavaProject selection) {
super(shell);
this.items = differences;
listSelectionDialog = new ListSelectionDialog(shell, differences,
new ArrayContentProvider(),
new LabelProvider(), Messages.FilesChangedListDialog_Changes);
this.git = git;
this.setSelection(selection);
this.setHelpAvailable(false);
setAuthor(Constants.ANONYMOUS);
setCommitter(Constants.ANONYMOUS);
Activator.getDefault().getPreferenceStore().addPropertyChangeListener(new IPropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent event) {
if (event.getProperty().equals(PreferenceConstants.P_COMMIT_SIGNATURE_ACTIVE)) {
if(getShell() != null) {
getShell().redraw();
getShell().layout();
refreshView();
}
}
}
});
}
示例4: createDialog
import org.eclipse.ui.dialogs.ListSelectionDialog; //导入依赖的package包/类
/**
* Creates the dialog for working set assignment.
*
* @param workingSets
* All the working set the user should be able to select from
* @param numberOfSelectedProjects
* The number of selected projects
*/
private ListSelectionDialog createDialog(Collection<WorkingSet> workingSets, int numberOfSelectedProjects) {
// Filter 'Other Projects' working set
List<WorkingSet> selectableWorkingSets = workingSets.stream()
.filter(set -> !set.getId().equals(WorkingSet.OTHERS_WORKING_SET_ID)).collect(Collectors.toList());
String message = String.format(DIALOG_SUBTITLE, numberOfSelectedProjects);
ListSelectionDialog dialog = new NonEmptyListSelectionDialog(site.getShell(),
selectableWorkingSets, ArrayContentProvider.getInstance(), WorkingSetLabelProvider.INSTANCE, message);
dialog.setTitle(DIALOG_TITLE);
return dialog;
}
示例5: getNewInputObject
import org.eclipse.ui.dialogs.ListSelectionDialog; //导入依赖的package包/类
@Override
protected String getNewInputObject() {
final String[] currentItems = this.list.getItems();
final IProject[] allProjects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
final ILabelProvider labelProvider = new LabelProvider() {
@Override
public String getText(final Object element) {
return (String) element;
}
};
final SimpleListContentProvider contentsProvider = new SimpleListContentProvider();
contentsProvider.setElements(this.sortedDifference(allProjects, currentItems));
final ListSelectionDialog dialog = new ListSelectionDialog(this.getShell(), this, contentsProvider, labelProvider, PROJECT_SELECTION_LABEL);
if (dialog.open() != 0) {
return null;
}
final Object[] result = dialog.getResult();
final int currentItemsLength = currentItems.length;
final int resultLength = result.length;
final String[] newItems = new String[currentItemsLength + resultLength];
System.arraycopy(currentItems, 0, newItems, 0, currentItemsLength);
System.arraycopy(result, 0, newItems, currentItemsLength, result.length);
this.list.setItems(newItems);
return null;
}
示例6: openSaveDialog
import org.eclipse.ui.dialogs.ListSelectionDialog; //导入依赖的package包/类
private static Object[] openSaveDialog(Shell shell, Collection<IEditorPart> editors) {
ListSelectionDialog lsd = new ListSelectionDialog(shell, editors, new ArrayContentProvider(),
getLabelProvider(), "Select resources to save:");
lsd.setInitialSelections(editors.toArray());
lsd.setTitle("Save and Launch");
lsd.open();
return lsd.getResult();
}
示例7: computeModifications
import org.eclipse.ui.dialogs.ListSelectionDialog; //导入依赖的package包/类
private void computeModifications() {
Set<ChangedFile> modifications = DescribeVersionsDialogUtil.computeModifications(this.getShell(), git, getOlderVersionText().getText(), getNewerVersionText().getText());
listSelectionDialog = new ListSelectionDialog(this.shellTmp.getShell(),
modifications, new ArrayContentProvider(), new LabelProvider(), Messages.FilesChangedListDialog_Changes);
items = modifications;
if(items != null) {
filesViewer.setInput(items.toArray());
}
}
示例8: addProjectDialog
import org.eclipse.ui.dialogs.ListSelectionDialog; //导入依赖的package包/类
private IDECPListElement[] addProjectDialog( )
{
try
{
Object[] selectArr = getNotYetRequiredProjects( );
new JavaElementComparator( ).sort( null, selectArr );
ListSelectionDialog dialog = new ListSelectionDialog( getShell( ),
Arrays.asList( selectArr ),
new ArrayContentProvider( ),
new ProjectLabelProvider( ),
Messages.getString("IDEClassPathBlock.ProjectDialog_message") ); //$NON-NLS-1$
dialog.setTitle( Messages.getString("IDEClassPathBlock.ProjectDialog_title") ); //$NON-NLS-1$
dialog.setHelpAvailable( false );
if ( dialog.open( ) == Window.OK )
{
Object[] result = dialog.getResult( );
IDECPListElement[] cpElements = new IDECPListElement[result.length];
for ( int i = 0; i < result.length; i++ )
{
IJavaProject curr = ( (IJavaProject) result[i] );
cpElements[i] = new IDECPListElement( IClasspathEntry.CPE_PROJECT,
curr.getPath( ),
curr.getResource( ) );
}
return cpElements;
}
}
catch ( JavaModelException e )
{
return null;
}
return null;
}
示例9: addVariables
import org.eclipse.ui.dialogs.ListSelectionDialog; //导入依赖的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);
}
ListSelectionDialog dialog =
new ListSelectionDialog(
this.getShell(),
this,
contentsProvider,
labelProvider,
Policy.bind("SVNDecoratorPreferencesPage.selectVariablesToAdd")); //$NON-NLS-1$
dialog.setTitle(Policy.bind("SVNDecoratorPreferencesPage.AddVariables")); //$NON-NLS-1$
if (dialog.open() != ListSelectionDialog.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$
}
}
示例10: getListSelectionDialog
import org.eclipse.ui.dialogs.ListSelectionDialog; //导入依赖的package包/类
public ListSelectionDialog getListSelectionDialog() {
return listSelectionDialog;
}
示例11: setListSelectionDialog
import org.eclipse.ui.dialogs.ListSelectionDialog; //导入依赖的package包/类
public void setListSelectionDialog(ListSelectionDialog listSelectionDialog) {
this.listSelectionDialog = listSelectionDialog;
}