Search in sources :

Example 6 with Dialog

use of org.eclipse.jface.dialogs.Dialog in project pentaho-kettle by pentaho.

the class Spoon method loadLastUsedFile.

private void loadLastUsedFile(LastUsedFile lastUsedFile, String repositoryName, boolean trackIt, boolean isStartup) throws KettleException {
    boolean useRepository = repositoryName != null;
    // 
    if (lastUsedFile.isSourceRepository()) {
        if (!Utils.isEmpty(lastUsedFile.getRepositoryName())) {
            if (useRepository && !lastUsedFile.getRepositoryName().equalsIgnoreCase(repositoryName)) {
                // We just asked...
                useRepository = false;
            }
        }
    }
    if (useRepository && lastUsedFile.isSourceRepository()) {
        if (rep != null) {
            // load from this repository...
            if (rep.getName().equalsIgnoreCase(lastUsedFile.getRepositoryName())) {
                RepositoryDirectoryInterface rdi = rep.findDirectory(lastUsedFile.getDirectory());
                if (rdi != null) {
                    // does the file exist in the repo?
                    final RepositoryObjectType fileType = lastUsedFile.isJob() ? RepositoryObjectType.JOB : RepositoryObjectType.TRANSFORMATION;
                    if (!rep.exists(lastUsedFile.getFilename(), rdi, fileType)) {
                        // opening this file
                        if (isStartup) {
                            if (log.isDetailed()) {
                                log.logDetailed(BaseMessages.getString(PKG, "Spoon.log.openingMissingFile"));
                            }
                        } else {
                            final Dialog dlg = new SimpleMessageDialog(shell, BaseMessages.getString(PKG, "Spoon.Dialog.MissingRecentFile.Title"), BaseMessages.getString(PKG, "Spoon.Dialog.MissingRecentFile.Message", lastUsedFile.getLongFileType().toLowerCase()), MessageDialog.ERROR, BaseMessages.getString(PKG, "System.Button.Close"), MISSING_RECENT_DLG_WIDTH, SimpleMessageDialog.BUTTON_WIDTH);
                            dlg.open();
                        }
                    } else {
                        // Are we loading a transformation or a job?
                        if (lastUsedFile.isTransformation()) {
                            if (log.isDetailed()) {
                                // "Auto loading transformation ["+lastfiles[0]+"] from repository directory ["+lastdirs[0]+"]"
                                log.logDetailed(BaseMessages.getString(PKG, "Spoon.Log.AutoLoadingTransformation", lastUsedFile.getFilename(), lastUsedFile.getDirectory()));
                            }
                            TransLoadProgressDialog tlpd = new TransLoadProgressDialog(shell, rep, lastUsedFile.getFilename(), rdi, null);
                            TransMeta transMeta = tlpd.open();
                            if (transMeta != null) {
                                if (trackIt) {
                                    props.addLastFile(LastUsedFile.FILE_TYPE_TRANSFORMATION, lastUsedFile.getFilename(), rdi.getPath(), true, rep.getName(), getUsername(), null);
                                }
                                // transMeta.setFilename(lastUsedFile.getFilename());
                                transMeta.clearChanged();
                                addTransGraph(transMeta);
                                refreshTree();
                            }
                        } else if (lastUsedFile.isJob()) {
                            JobLoadProgressDialog progressDialog = new JobLoadProgressDialog(shell, rep, lastUsedFile.getFilename(), rdi, null);
                            JobMeta jobMeta = progressDialog.open();
                            if (jobMeta != null) {
                                if (trackIt) {
                                    props.addLastFile(LastUsedFile.FILE_TYPE_JOB, lastUsedFile.getFilename(), rdi.getPath(), true, rep.getName(), getUsername(), null);
                                }
                                jobMeta.clearChanged();
                                addJobGraph(jobMeta);
                            }
                        }
                        refreshTree();
                    }
                }
            }
        }
    }
    // open files stored locally, not in the repository
    if (!lastUsedFile.isSourceRepository() && !Utils.isEmpty(lastUsedFile.getFilename())) {
        if (lastUsedFile.isTransformation()) {
            openFile(lastUsedFile.getFilename(), rep != null);
        }
        if (lastUsedFile.isJob()) {
            openFile(lastUsedFile.getFilename(), false);
        }
        refreshTree();
    }
}
Also used : RepositoryDirectoryInterface(org.pentaho.di.repository.RepositoryDirectoryInterface) JobMeta(org.pentaho.di.job.JobMeta) SimpleMessageDialog(org.pentaho.di.ui.core.dialog.SimpleMessageDialog) TransLoadProgressDialog(org.pentaho.di.ui.trans.dialog.TransLoadProgressDialog) LogSettingsDialog(org.pentaho.di.ui.spoon.dialog.LogSettingsDialog) MessageDialog(org.eclipse.jface.dialogs.MessageDialog) SubjectDataBrowserDialog(org.pentaho.di.ui.core.dialog.SubjectDataBrowserDialog) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) ImportRulesDialog(org.pentaho.di.ui.imp.ImportRulesDialog) RepositoriesDialog(org.pentaho.di.ui.repository.RepositoriesDialog) KettlePropertiesFileDialog(org.pentaho.di.ui.core.dialog.KettlePropertiesFileDialog) EnterMappingDialog(org.pentaho.di.ui.core.dialog.EnterMappingDialog) Dialog(org.eclipse.jface.dialogs.Dialog) CheckTransProgressDialog(org.pentaho.di.ui.spoon.dialog.CheckTransProgressDialog) PreviewRowsDialog(org.pentaho.di.ui.core.dialog.PreviewRowsDialog) ShowMessageDialog(org.pentaho.di.ui.core.dialog.ShowMessageDialog) CapabilityManagerDialog(org.pentaho.di.ui.spoon.dialog.CapabilityManagerDialog) TransHopDialog(org.pentaho.di.ui.trans.dialog.TransHopDialog) TransLoadProgressDialog(org.pentaho.di.ui.trans.dialog.TransLoadProgressDialog) EnterOptionsDialog(org.pentaho.di.ui.core.dialog.EnterOptionsDialog) BrowserEnvironmentWarningDialog(org.pentaho.di.ui.core.dialog.BrowserEnvironmentWarningDialog) AuthProviderDialog(org.pentaho.di.ui.core.auth.AuthProviderDialog) EnterSearchDialog(org.pentaho.di.ui.core.dialog.EnterSearchDialog) EnterStringsDialog(org.pentaho.di.ui.core.dialog.EnterStringsDialog) VfsFileChooserDialog(org.pentaho.vfs.ui.VfsFileChooserDialog) EnterTextDialog(org.pentaho.di.ui.core.dialog.EnterTextDialog) EnterSelectionDialog(org.pentaho.di.ui.core.dialog.EnterSelectionDialog) SelectDirectoryDialog(org.pentaho.di.ui.repository.dialog.SelectDirectoryDialog) MetaStoreExplorerDialog(org.pentaho.di.ui.spoon.dialog.MetaStoreExplorerDialog) RepositoryImportProgressDialog(org.pentaho.di.ui.repository.dialog.RepositoryImportProgressDialog) SaveProgressDialog(org.pentaho.di.ui.spoon.dialog.SaveProgressDialog) AnalyseImpactProgressDialog(org.pentaho.di.ui.spoon.dialog.AnalyseImpactProgressDialog) RepositoryExportProgressDialog(org.pentaho.di.ui.repository.dialog.RepositoryExportProgressDialog) AboutDialog(org.pentaho.di.ui.core.dialog.AboutDialog) JobLoadProgressDialog(org.pentaho.di.ui.job.dialog.JobLoadProgressDialog) WizardDialog(org.eclipse.jface.wizard.WizardDialog) SimpleMessageDialog(org.pentaho.di.ui.core.dialog.SimpleMessageDialog) CheckResultDialog(org.pentaho.di.ui.core.dialog.CheckResultDialog) ShowBrowserDialog(org.pentaho.di.ui.core.dialog.ShowBrowserDialog) FileDialog(org.eclipse.swt.widgets.FileDialog) TransMeta(org.pentaho.di.trans.TransMeta) RepositoryObjectType(org.pentaho.di.repository.RepositoryObjectType) JobLoadProgressDialog(org.pentaho.di.ui.job.dialog.JobLoadProgressDialog)

Example 7 with Dialog

use of org.eclipse.jface.dialogs.Dialog in project xtext-eclipse by eclipse.

the class RefactoringWizardOpenOperation_NonForking method run.

/**
 * That one exists since
 * see RefactoringWizardOpenOperation#run(Shell, String, IRunnableContext)
 * - not a JavaDoc link since this breaks the build on Galileo :-)
 */
public int run(final Shell parent, final String dialogTitle, final IRunnableContext context) throws InterruptedException {
    Assert.isNotNull(dialogTitle);
    final Refactoring refactoring = fWizard.getRefactoring();
    final IJobManager manager = Job.getJobManager();
    final int[] result = new int[1];
    final InterruptedException[] canceled = new InterruptedException[1];
    Runnable r = new Runnable() {

        @Override
        public void run() {
            try {
                // we are getting the block dialog for free if we pass in null
                manager.beginRule(ResourcesPlugin.getWorkspace().getRoot(), null);
                refactoring.setValidationContext(parent);
                fInitialConditions = checkInitialConditions(refactoring, parent, dialogTitle, context);
                if (fInitialConditions.hasFatalError()) {
                    String message = fInitialConditions.getMessageMatchingSeverity(RefactoringStatus.FATAL);
                    MessageDialog.openError(parent, dialogTitle, message);
                    result[0] = INITIAL_CONDITION_CHECKING_FAILED;
                } else {
                    fWizard.setInitialConditionCheckingStatus(fInitialConditions);
                    /* CHANGE: don't use package private RefactoringUI */
                    Dialog dialog = createRefactoringWizardDialog(fWizard, parent);
                    dialog.create();
                    IWizardContainer wizardContainer = (IWizardContainer) dialog;
                    if (wizardContainer.getCurrentPage() == null)
                        /*
							 * Don't show the dialog at all if there are no user
							 * input pages and change creation was cancelled.
							 */
                        result[0] = Window.CANCEL;
                    else
                        result[0] = dialog.open();
                }
            } catch (InterruptedException e) {
                canceled[0] = e;
            } catch (OperationCanceledException e) {
                canceled[0] = new InterruptedException(e.getMessage());
            } finally {
                manager.endRule(ResourcesPlugin.getWorkspace().getRoot());
                refactoring.setValidationContext(null);
                disposeRefactoringContext(fWizard);
            }
        }
    };
    BusyIndicator.showWhile(parent != null ? parent.getDisplay() : null, r);
    if (canceled[0] != null)
        throw canceled[0];
    return result[0];
}
Also used : IWizardContainer(org.eclipse.jface.wizard.IWizardContainer) MessageDialog(org.eclipse.jface.dialogs.MessageDialog) Dialog(org.eclipse.jface.dialogs.Dialog) RefactoringWizardDialog(org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog) OperationCanceledException(org.eclipse.core.runtime.OperationCanceledException) IJobManager(org.eclipse.core.runtime.jobs.IJobManager) Refactoring(org.eclipse.ltk.core.refactoring.Refactoring)

Example 8 with Dialog

use of org.eclipse.jface.dialogs.Dialog in project cubrid-manager by CUBRID.

the class PropertyAction method run.

/**
	 * Open property dialog,view and set property
	 */
public void run() {
    final Object[] obj = this.getSelectedObj();
    if (!isSupported(obj[0])) {
        return;
    }
    final ICubridNode node = (ICubridNode) obj[0];
    Dialog dialog = PreferenceUtil.createPropertyDialog(getShell(), node);
    dialog.open();
}
Also used : Dialog(org.eclipse.jface.dialogs.Dialog) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode)

Example 9 with Dialog

use of org.eclipse.jface.dialogs.Dialog in project eclipse.platform.text by eclipse.

the class TextEditorDefaultsPreferencePage method createAppearancePage.

private Control createAppearancePage(Composite parent) {
    Composite appearanceComposite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    appearanceComposite.setLayout(layout);
    Link fontLink = new Link(appearanceComposite, SWT.NONE);
    fontLink.setText(TextEditorMessages.TextEditorPreferencePage_Font_link);
    fontLink.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            // $NON-NLS-1$ //$NON-NLS-2$
            PreferencesUtil.createPreferenceDialogOn(getShell(), "org.eclipse.ui.preferencePages.ColorsAndFonts", null, "selectFont:" + JFaceResources.TEXT_FONT);
        }
    });
    GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gd.horizontalSpan = 2;
    fontLink.setLayoutData(gd);
    addFiller(appearanceComposite, 2);
    String label = TextEditorMessages.TextEditorPreferencePage_undoHistorySize;
    Preference undoHistorySize = new Preference(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_UNDO_HISTORY_SIZE, label, null);
    IntegerDomain undoHistorySizeDomain = new IntegerDomain(0, 99999);
    addTextField(appearanceComposite, undoHistorySize, undoHistorySizeDomain, 15, 0);
    label = TextEditorMessages.TextEditorPreferencePage_displayedTabWidth;
    Preference tabWidth = new Preference(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH, label, null);
    IntegerDomain tabWidthDomain = new IntegerDomain(1, 16);
    addTextField(appearanceComposite, tabWidth, tabWidthDomain, 15, 0);
    if (isWordWrapPreferenceAllowed()) {
        label = TextEditorMessages.TextEditorPreferencePage_enableWordWrap;
        Preference enableWordWrap = new Preference(AbstractTextEditor.PREFERENCE_WORD_WRAP_ENABLED, label, null);
        addCheckBox(appearanceComposite, enableWordWrap, new BooleanDomain(), 0);
    }
    label = TextEditorMessages.TextEditorPreferencePage_convertTabsToSpaces;
    Preference spacesForTabs = new Preference(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS, label, null);
    addCheckBox(appearanceComposite, spacesForTabs, new BooleanDomain(), 0);
    label = TextEditorMessages.TextEditorPreferencePage_highlightCurrentLine;
    Preference highlightCurrentLine = new Preference(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE, label, null);
    addCheckBox(appearanceComposite, highlightCurrentLine, new BooleanDomain(), 0);
    label = TextEditorMessages.TextEditorPreferencePage_showPrintMargin;
    Preference showPrintMargin = new Preference(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN, label, null);
    final Button showPrintMarginButton = addCheckBox(appearanceComposite, showPrintMargin, new BooleanDomain(), 0);
    label = TextEditorMessages.TextEditorPreferencePage_printMarginColumn;
    Preference printMarginColumn = new Preference(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN, label, null);
    final IntegerDomain printMarginDomain = new IntegerDomain(20, 200);
    final Control[] printMarginControls = addTextField(appearanceComposite, printMarginColumn, printMarginDomain, 15, 20);
    createDependency(showPrintMarginButton, showPrintMargin, printMarginControls);
    showPrintMarginButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            updateStatus(printMarginDomain);
        }
    });
    label = TextEditorMessages.TextEditorPreferencePage_showLineNumbers;
    Preference showLineNumbers = new Preference(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER, label, null);
    addCheckBox(appearanceComposite, showLineNumbers, new BooleanDomain(), 0);
    label = TextEditorMessages.TextEditorDefaultsPreferencePage_range_indicator;
    Preference showMagnet = new Preference(AbstractDecoratedTextEditorPreferenceConstants.SHOW_RANGE_INDICATOR, label, null);
    addCheckBox(appearanceComposite, showMagnet, new BooleanDomain(), 0);
    label = TextEditorMessages.TextEditorDefaultsPreferencePage_showWhitespaceCharacters;
    String linkText = TextEditorMessages.TextEditorDefaultsPreferencePage_showWhitespaceCharactersLinkText;
    Preference showWhitespaceCharacters = new Preference(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SHOW_WHITESPACE_CHARACTERS, label, null);
    addCheckBoxWithLink(appearanceComposite, showWhitespaceCharacters, linkText, new BooleanDomain(), 0, new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            Dialog dialog = new WhitespaceCharacterPainterOptionsDialog(Display.getDefault().getActiveShell(), fOverlayStore);
            dialog.open();
        }
    });
    label = TextEditorMessages.TextEditorPreferencePage_showAffordance;
    Preference showAffordance = new Preference(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SHOW_TEXT_HOVER_AFFORDANCE, label, null);
    addCheckBox(appearanceComposite, showAffordance, new BooleanDomain(), 0);
    label = TextEditorMessages.TextEditorDefaultsPreferencePage_enrichHoverMode;
    Preference hoverReplace = new Preference(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HOVER_ENRICH_MODE, label, null);
    EnumeratedDomain hoverReplaceDomain = new EnumeratedDomain();
    hoverReplaceDomain.addValue(new EnumValue(-1, TextEditorMessages.TextEditorDefaultsPreferencePage_enrichHover_disabled));
    hoverReplaceDomain.addValue(new EnumValue(1, TextEditorMessages.TextEditorDefaultsPreferencePage_enrichHover_immediately));
    hoverReplaceDomain.addValue(new EnumValue(0, TextEditorMessages.TextEditorDefaultsPreferencePage_enrichHover_afterDelay));
    hoverReplaceDomain.addValue(new EnumValue(2, TextEditorMessages.TextEditorDefaultsPreferencePage_enrichHover_onClick));
    addCombo(appearanceComposite, hoverReplace, hoverReplaceDomain, 0);
    label = TextEditorMessages.TextEditorDefaultsPreferencePage_textDragAndDrop;
    Preference textDragAndDrop = new Preference(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TEXT_DRAG_AND_DROP_ENABLED, label, null);
    addCheckBox(appearanceComposite, textDragAndDrop, new BooleanDomain(), 0);
    label = TextEditorMessages.TextEditorDefaultsPreferencePage_warn_if_derived;
    Preference warnIfDerived = new Preference(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_WARN_IF_INPUT_DERIVED, label, null);
    addCheckBox(appearanceComposite, warnIfDerived, new BooleanDomain(), 0);
    label = TextEditorMessages.TextEditorDefaultsPreferencePage_smartHomeEnd;
    Preference smartHomeEnd = new Preference(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SMART_HOME_END, label, null);
    addCheckBox(appearanceComposite, smartHomeEnd, new BooleanDomain(), 0);
    addFiller(appearanceComposite, 2);
    Label l = new Label(appearanceComposite, SWT.LEFT);
    l.setText(TextEditorMessages.TextEditorPreferencePage_appearanceOptions);
    gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gd.horizontalSpan = 2;
    l.setLayoutData(gd);
    Composite editorComposite = new Composite(appearanceComposite, SWT.NONE);
    layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    editorComposite.setLayout(layout);
    gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL);
    gd.horizontalSpan = 2;
    editorComposite.setLayoutData(gd);
    fAppearanceColorList = new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
    gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_BOTH);
    gd.heightHint = fAppearanceColorList.getItemHeight() * 8;
    fAppearanceColorList.setLayoutData(gd);
    Composite stylesComposite = new Composite(editorComposite, SWT.NONE);
    layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 2;
    stylesComposite.setLayout(layout);
    stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    l = new Label(stylesComposite, SWT.LEFT);
    l.setText(TextEditorMessages.TextEditorPreferencePage_color);
    gd = new GridData();
    gd.horizontalAlignment = GridData.BEGINNING;
    l.setLayoutData(gd);
    fAppearanceColorEditor = new ColorSelector(stylesComposite);
    Button foregroundColorButton = fAppearanceColorEditor.getButton();
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalAlignment = GridData.BEGINNING;
    foregroundColorButton.setLayoutData(gd);
    SelectionListener colorDefaultSelectionListener = new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            boolean systemDefault = fAppearanceColorDefault.getSelection();
            fAppearanceColorEditor.getButton().setEnabled(!systemDefault);
            int i = fAppearanceColorList.getSelectionIndex();
            if (i == -1)
                return;
            String key = fAppearanceColorListModel[i][2];
            if (key != null)
                fOverlayStore.setValue(key, systemDefault);
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    };
    fAppearanceColorDefault = new Button(stylesComposite, SWT.CHECK);
    fAppearanceColorDefault.setText(TextEditorMessages.TextEditorPreferencePage_systemDefault);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalAlignment = GridData.BEGINNING;
    gd.horizontalSpan = 2;
    fAppearanceColorDefault.setLayoutData(gd);
    fAppearanceColorDefault.setVisible(false);
    fAppearanceColorDefault.addSelectionListener(colorDefaultSelectionListener);
    fAppearanceColorList.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        // do nothing
        }

        @Override
        public void widgetSelected(SelectionEvent e) {
            handleAppearanceColorListSelection();
        }
    });
    foregroundColorButton.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        // do nothing
        }

        @Override
        public void widgetSelected(SelectionEvent e) {
            int i = fAppearanceColorList.getSelectionIndex();
            if (i == -1)
                return;
            String key = fAppearanceColorListModel[i][1];
            PreferenceConverter.setValue(fOverlayStore, key, fAppearanceColorEditor.getColorValue());
        }
    });
    Link link = new Link(appearanceComposite, SWT.NONE);
    link.setText(TextEditorMessages.TextEditorPreferencePage_colorsAndFonts_link);
    link.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            // $NON-NLS-1$ //$NON-NLS-2$
            PreferencesUtil.createPreferenceDialogOn(getShell(), "org.eclipse.ui.preferencePages.ColorsAndFonts", null, "selectCategory:org.eclipse.ui.workbenchMisc");
        }
    });
    GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
    // only expand further if anyone else requires it
    gridData.widthHint = 150;
    gridData.horizontalSpan = 2;
    link.setLayoutData(gridData);
    addFiller(appearanceComposite, 2);
    appearanceComposite.layout();
    return appearanceComposite;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) EnumValue(org.eclipse.ui.internal.editors.text.TextEditorDefaultsPreferencePage.EnumeratedDomain.EnumValue) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) GridLayout(org.eclipse.swt.layout.GridLayout) Control(org.eclipse.swt.widgets.Control) Button(org.eclipse.swt.widgets.Button) Dialog(org.eclipse.jface.dialogs.Dialog) SelectionEvent(org.eclipse.swt.events.SelectionEvent) GridData(org.eclipse.swt.layout.GridData) ArrayList(java.util.ArrayList) List(org.eclipse.swt.widgets.List) ColorSelector(org.eclipse.jface.preference.ColorSelector) Link(org.eclipse.swt.widgets.Link) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 10 with Dialog

use of org.eclipse.jface.dialogs.Dialog in project egit by eclipse.

the class FetchGerritChangePage method getRefsForContentAssist.

private Collection<Change> getRefsForContentAssist(String originalRefText) throws InvocationTargetException, InterruptedException {
    String uriText = uriCombo.getText();
    if (!changeRefs.containsKey(uriText)) {
        changeRefs.put(uriText, new ChangeList(repository, uriText));
    }
    ChangeList list = changeRefs.get(uriText);
    if (!list.isFinished()) {
        IWizardContainer container = getContainer();
        IRunnableWithProgress operation = monitor -> {
            monitor.beginTask(MessageFormat.format(UIText.AsynchronousRefProposalProvider_FetchingRemoteRefsMessage, uriText), IProgressMonitor.UNKNOWN);
            Collection<Change> result = list.get();
            if (monitor.isCanceled()) {
                return;
            }
            // If we get here, the ChangeList future is done.
            if (result == null || result.isEmpty() || fetching) {
                // Don't bother if we didn't get any results
                return;
            }
            // If we do have results now, open the proposals.
            Job showProposals = new WorkbenchJob(UIText.AsynchronousRefProposalProvider_ShowingProposalsJobName) {

                @Override
                public boolean shouldRun() {
                    return super.shouldRun() && !fetching;
                }

                @Override
                public IStatus runInUIThread(IProgressMonitor uiMonitor) {
                    // the same
                    try {
                        if (container instanceof NonBlockingWizardDialog) {
                            // focus will be restored
                            if (fetching) {
                                return Status.CANCEL_STATUS;
                            }
                            String uriNow = uriCombo.getText();
                            if (!uriNow.equals(uriText)) {
                                return Status.CANCEL_STATUS;
                            }
                            if (refText != refText.getDisplay().getFocusControl()) {
                                fillInPatchSet(result, null);
                                return Status.CANCEL_STATUS;
                            }
                            // Try not to interfere with the user's typing.
                            // Only fill in the patch set number if the text
                            // is still the same.
                            fillInPatchSet(result, originalRefText);
                            doAutoFill = false;
                        } else {
                            // Dialog was blocked
                            fillInPatchSet(result, null);
                            doAutoFill = false;
                        }
                        contentProposer.openProposalPopup();
                    } catch (SWTException e) {
                        // Disposed already
                        return Status.CANCEL_STATUS;
                    } finally {
                        doAutoFill = true;
                        uiMonitor.done();
                    }
                    return Status.OK_STATUS;
                }
            };
            showProposals.schedule();
        };
        if (container instanceof NonBlockingWizardDialog) {
            NonBlockingWizardDialog dialog = (NonBlockingWizardDialog) container;
            dialog.run(operation, () -> {
                if (!fetching) {
                    list.cancel(ChangeList.CancelMode.ABANDON);
                }
            });
        } else {
            container.run(true, true, operation);
        }
        return null;
    }
    // ChangeList is already here, so get() won't block
    Collection<Change> changes = list.get();
    if (doAutoFill) {
        fillInPatchSet(changes, originalRefText);
    }
    return changes;
}
Also used : SortedSet(java.util.SortedSet) UIPreferences(org.eclipse.egit.ui.UIPreferences) Date(java.util.Date) URISyntaxException(java.net.URISyntaxException) CoreException(org.eclipse.core.runtime.CoreException) ExplicitContentProposalAdapter(org.eclipse.egit.ui.UIUtils.ExplicitContentProposalAdapter) RemoteConfig(org.eclipse.jgit.transport.RemoteConfig) IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) Clipboard(org.eclipse.swt.dnd.Clipboard) RevWalk(org.eclipse.jgit.revwalk.RevWalk) IStatus(org.eclipse.core.runtime.IStatus) OperationCanceledException(org.eclipse.core.runtime.OperationCanceledException) Matcher(java.util.regex.Matcher) Composite(org.eclipse.swt.widgets.Composite) Map(java.util.Map) KeyEvent(org.eclipse.swt.events.KeyEvent) URIish(org.eclipse.jgit.transport.URIish) FetchResult(org.eclipse.jgit.transport.FetchResult) SWTException(org.eclipse.swt.SWTException) IContentProposal(org.eclipse.jface.fieldassist.IContentProposal) KeyAdapter(org.eclipse.swt.events.KeyAdapter) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) JobFamilies(org.eclipse.egit.ui.JobFamilies) Text(org.eclipse.swt.widgets.Text) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) TagBuilder(org.eclipse.jgit.lib.TagBuilder) NLS(org.eclipse.osgi.util.NLS) ActionUtils(org.eclipse.egit.ui.internal.ActionUtils) RefSpec(org.eclipse.jgit.transport.RefSpec) Collection(java.util.Collection) Status(org.eclipse.core.runtime.Status) Constants(org.eclipse.jgit.lib.Constants) AsynchronousListOperation(org.eclipse.egit.ui.internal.components.AsynchronousListOperation) AbstractBranchSelectionDialog(org.eclipse.egit.ui.internal.dialogs.AbstractBranchSelectionDialog) InvocationTargetException(java.lang.reflect.InvocationTargetException) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) Transfer(org.eclipse.swt.dnd.Transfer) Objects(java.util.Objects) PersonIdent(org.eclipse.jgit.lib.PersonIdent) TagOperation(org.eclipse.egit.core.op.TagOperation) GerritDialogSettings(org.eclipse.egit.ui.internal.gerrit.GerritDialogSettings) List(java.util.List) Window(org.eclipse.jface.window.Window) UIText(org.eclipse.egit.ui.internal.UIText) Ref(org.eclipse.jgit.lib.Ref) SWT(org.eclipse.swt.SWT) Pattern(java.util.regex.Pattern) IPageChangeProvider(org.eclipse.jface.dialogs.IPageChangeProvider) IWizardContainer(org.eclipse.jface.wizard.IWizardContainer) Label(org.eclipse.swt.widgets.Label) IWorkspaceRunnable(org.eclipse.core.resources.IWorkspaceRunnable) ResourcesPlugin(org.eclipse.core.resources.ResourcesPlugin) RevCommit(org.eclipse.jgit.revwalk.RevCommit) Activator(org.eclipse.egit.ui.Activator) SubMonitor(org.eclipse.core.runtime.SubMonitor) SimpleDateFormat(java.text.SimpleDateFormat) HashMap(java.util.HashMap) JFaceResources(org.eclipse.jface.resource.JFaceResources) WorkbenchJob(org.eclipse.ui.progress.WorkbenchJob) TreeSet(java.util.TreeSet) MessageFormat(java.text.MessageFormat) ArrayList(java.util.ArrayList) ValidationUtils(org.eclipse.egit.ui.internal.ValidationUtils) IWorkspace(org.eclipse.core.resources.IWorkspace) PageChangedEvent(org.eclipse.jface.dialogs.PageChangedEvent) TextTransfer(org.eclipse.swt.dnd.TextTransfer) WizardPage(org.eclipse.jface.wizard.WizardPage) GridData(org.eclipse.swt.layout.GridData) LinkedHashSet(java.util.LinkedHashSet) IPageChangedListener(org.eclipse.jface.dialogs.IPageChangedListener) BranchNameNormalizer(org.eclipse.egit.ui.internal.components.BranchNameNormalizer) Combo(org.eclipse.swt.widgets.Combo) Job(org.eclipse.core.runtime.jobs.Job) CreateLocalBranchOperation(org.eclipse.egit.core.op.CreateLocalBranchOperation) GridDataFactory(org.eclipse.jface.layout.GridDataFactory) IOException(java.io.IOException) NonBlockingWizardDialog(org.eclipse.egit.ui.internal.dialogs.NonBlockingWizardDialog) Group(org.eclipse.swt.widgets.Group) BranchOperationUI(org.eclipse.egit.ui.internal.branch.BranchOperationUI) Dialog(org.eclipse.jface.dialogs.Dialog) ModifyListener(org.eclipse.swt.events.ModifyListener) GerritUtil(org.eclipse.egit.core.internal.gerrit.GerritUtil) UIUtils(org.eclipse.egit.ui.UIUtils) IInputValidator(org.eclipse.jface.dialogs.IInputValidator) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress) BranchEditDialog(org.eclipse.egit.ui.internal.dialogs.BranchEditDialog) ActionFactory(org.eclipse.ui.actions.ActionFactory) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Collections(java.util.Collections) Repository(org.eclipse.jgit.lib.Repository) Control(org.eclipse.swt.widgets.Control) GridLayout(org.eclipse.swt.layout.GridLayout) IStatus(org.eclipse.core.runtime.IStatus) WorkbenchJob(org.eclipse.ui.progress.WorkbenchJob) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress) IWizardContainer(org.eclipse.jface.wizard.IWizardContainer) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) NonBlockingWizardDialog(org.eclipse.egit.ui.internal.dialogs.NonBlockingWizardDialog) SWTException(org.eclipse.swt.SWTException) Collection(java.util.Collection) WorkbenchJob(org.eclipse.ui.progress.WorkbenchJob) Job(org.eclipse.core.runtime.jobs.Job)

Aggregations

Dialog (org.eclipse.jface.dialogs.Dialog)49 MessageDialog (org.eclipse.jface.dialogs.MessageDialog)15 FileDialog (org.eclipse.swt.widgets.FileDialog)11 Composite (org.eclipse.swt.widgets.Composite)9 ArrayList (java.util.ArrayList)8 WizardDialog (org.eclipse.jface.wizard.WizardDialog)8 Control (org.eclipse.swt.widgets.Control)7 Shell (org.eclipse.swt.widgets.Shell)7 GridData (org.eclipse.swt.layout.GridData)6 Button (org.eclipse.swt.widgets.Button)6 ITextSelection (org.eclipse.jface.text.ITextSelection)5 GridLayout (org.eclipse.swt.layout.GridLayout)5 IStructuredCleanupProcessor (org.eclipse.wst.sse.core.internal.cleanup.IStructuredCleanupProcessor)5 IStructuredModel (org.eclipse.wst.sse.core.internal.provisional.IStructuredModel)5 File (java.io.File)4 Client (name.abuchen.portfolio.model.Client)4 ITextEditor (org.eclipse.ui.texteditor.ITextEditor)4 List (java.util.List)3 SWT (org.eclipse.swt.SWT)3 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)3