Java Code Examples for org.eclipse.ui.dialogs.ListDialog#setTitle()

The following examples show how to use org.eclipse.ui.dialogs.ListDialog#setTitle() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReorgQueries.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
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();
		}
	};
}
 
Example 2
Source File: ReorgQueries.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private Runnable createQueryRunnable(final String question, final Object[] elements, final int[] result) {
	return new Runnable() {
		public void run() {
			ListDialog dialog= new YesNoListDialog(fShell, false);
			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();
		}
	};
}
 
Example 3
Source File: ResourceCloseManagement.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
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;
}
 
Example 4
Source File: ConfigureProjectFromBluePrintAction.java    From eclipse-cs with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void run(IAction action) {

  IProject[] projects = CheckstyleUIPlugin.getWorkspace().getRoot().getProjects();
  List<IProject> filteredProjects = new ArrayList<>();
  for (int i = 0; i < projects.length; i++) {
    filteredProjects.add(projects[i]);
  }

  filteredProjects.removeAll(mSelectedProjects);

  ListDialog dialog = new ListDialog(mPart.getSite().getShell());
  dialog.setInput(filteredProjects);
  dialog.setContentProvider(new ArrayContentProvider());
  dialog.setLabelProvider(new WorkbenchLabelProvider());
  dialog.setMessage(Messages.ConfigureProjectFromBluePrintAction_msgSelectBlueprintProject);
  dialog.setTitle(Messages.ConfigureProjectFromBluePrintAction_titleSelectBlueprintProject);
  if (Window.OK == dialog.open()) {

    Object[] result = dialog.getResult();

    if (result.length > 0) {

      BulkConfigureJob job = new BulkConfigureJob((IProject) result[0], mSelectedProjects);
      job.schedule();
    }

  }
}
 
Example 5
Source File: RefactoringSaveHelper.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
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;
}
 
Example 6
Source File: RefactoringSaveHelper.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
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;
}
 
Example 7
Source File: NewMergeFileAssociationWizardPage.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
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$
        }
    }
 
Example 8
Source File: DiffMergePreferencePage.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
/**
 * 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$
    }
}
 
Example 9
Source File: MergeFileAssociationPreferencePage.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
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$
        }
    }