Example usage for org.eclipse.jface.dialogs Dialog ELLIPSIS

List of usage examples for org.eclipse.jface.dialogs Dialog ELLIPSIS

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs Dialog ELLIPSIS.

Prototype

String ELLIPSIS

To view the source code for org.eclipse.jface.dialogs Dialog ELLIPSIS.

Click Source Link

Document

The ellipsis is the string that is used to represent shortened text.

Usage

From source file:com.siteview.mde.internal.ui.wizards.exports.AntGeneratingExportWizard.java

License:Open Source License

protected boolean performPreliminaryChecks() {
    // Check if we are going to overwrite an existing build.xml file
    if (!MessageDialogWithToggle.ALWAYS.equals(MDEPlugin.getDefault().getPreferenceStore()
            .getString(IPreferenceConstants.OVERWRITE_BUILD_FILES_ON_EXPORT))) {
        Object[] objects = fPage.getSelectedItems();
        List problemModels = new ArrayList();
        for (int i = 0; i < objects.length; i++) {
            Object object = objects[i];
            String installLocation = null;
            IResource underlyingResource = null;
            if (object instanceof WorkspaceMonitorModelBase) {
                installLocation = ((WorkspaceMonitorModelBase) object).getInstallLocation();
                underlyingResource = ((WorkspaceMonitorModelBase) object).getUnderlyingResource();
            } else if (object instanceof WorkspaceFeatureModel) {
                installLocation = ((WorkspaceFeatureModel) object).getInstallLocation();
                underlyingResource = ((WorkspaceFeatureModel) object).getUnderlyingResource();
            }//  w  w w .j a  va 2s  . com
            if (installLocation != null && underlyingResource != null) {
                File file = new File(installLocation, "build.xml"); //$NON-NLS-1$
                if (file.exists()) {
                    try {
                        IFile buildFile = PDEProject.getBuildProperties(underlyingResource.getProject());
                        IBuildModel buildModel = new WorkspaceBuildModel(buildFile);
                        buildModel.load();
                        if (buildModel != null) {
                            IBuildEntry entry = buildModel.getBuild()
                                    .getEntry(IBuildPropertiesConstants.PROPERTY_CUSTOM);
                            if (entry == null || !entry.contains(IBuildPropertiesConstants.TRUE)) {
                                problemModels.add(object);
                            }
                        }
                    } catch (CoreException e) {
                        MDEPlugin.log(e);
                    }
                }
            }
        }
        if (problemModels.size() > 0) {
            StringBuffer buf = new StringBuffer();
            MDELabelProvider labelProvider = new MDELabelProvider();
            int maxCount = 10;
            for (Iterator iterator = problemModels.iterator(); iterator.hasNext();) {
                buf.append(labelProvider.getText(iterator.next()));
                buf.append('\n');
                maxCount--;
                if (maxCount <= 0) {
                    buf.append(Dialog.ELLIPSIS);
                    break;
                }
            }

            MessageDialogWithToggle dialog = MessageDialogWithToggle.openOkCancelConfirm(getShell(),
                    MDEUIMessages.AntGeneratingExportWizard_0,
                    MessageFormat.format(MDEUIMessages.AntGeneratingExportWizard_1,
                            new String[] { buf.toString() }),
                    MDEUIMessages.AntGeneratingExportWizard_2, false,
                    MDEPlugin.getDefault().getPreferenceStore(),
                    IPreferenceConstants.OVERWRITE_BUILD_FILES_ON_EXPORT);
            if (dialog.getReturnCode() == Window.CANCEL) {
                return false;
            }
        }
    }
    if (fPage.doGenerateAntFile())
        generateAntBuildFile(fPage.getAntBuildFileName());
    return true;
}

From source file:com.sonatype.buildserver.eclipse.ui.job.view.SummaryPage.java

License:Open Source License

private String stripConfigName(String name) {
    if (name.startsWith(job.getJobName() + "/")) {
        name = name.substring(job.getJobName().length() + 1);
    }//from   ww w.  ja v  a 2 s  . c  o m
    if (name.contains(LABEL)) {
        name = name.substring(name.indexOf(LABEL) + LABEL.length());
        int comma = name.indexOf(",");
        if (comma > -1) {
            name = name.substring(0, comma - 1);
        }
    }
    if (name.length() > 20) {
        name = name.substring(0, 17) + Dialog.ELLIPSIS;
    }
    return name;
}

From source file:org.eclipse.pde.internal.ui.wizards.exports.AntGeneratingExportWizard.java

License:Open Source License

protected boolean performPreliminaryChecks() {
    // Check if we are going to overwrite an existing build.xml file
    if (!MessageDialogWithToggle.ALWAYS.equals(PDEPlugin.getDefault().getPreferenceStore()
            .getString(IPreferenceConstants.OVERWRITE_BUILD_FILES_ON_EXPORT))) {
        Object[] objects = fPage.getSelectedItems();
        List<Object> problemModels = new ArrayList<Object>();
        for (int i = 0; i < objects.length; i++) {
            Object object = objects[i];
            String installLocation = null;
            IResource underlyingResource = null;
            if (object instanceof WorkspacePluginModelBase) {
                installLocation = ((WorkspacePluginModelBase) object).getInstallLocation();
                underlyingResource = ((WorkspacePluginModelBase) object).getUnderlyingResource();
            } else if (object instanceof WorkspaceFeatureModel) {
                installLocation = ((WorkspaceFeatureModel) object).getInstallLocation();
                underlyingResource = ((WorkspaceFeatureModel) object).getUnderlyingResource();
            }//  w ww  .j a va  2s.  c om
            if (installLocation != null && underlyingResource != null) {
                File file = new File(installLocation, "build.xml"); //$NON-NLS-1$
                if (file.exists()) {
                    try {
                        IFile buildFile = PDEProject.getBuildProperties(underlyingResource.getProject());
                        IBuildModel buildModel = new WorkspaceBuildModel(buildFile);
                        buildModel.load();
                        IBuildEntry entry = buildModel.getBuild()
                                .getEntry(IBuildPropertiesConstants.PROPERTY_CUSTOM);
                        if (entry == null || !entry.contains(IBuildPropertiesConstants.TRUE)) {
                            problemModels.add(object);
                        }
                    } catch (CoreException e) {
                        PDEPlugin.log(e);
                    }
                }
            }
        }
        if (problemModels.size() > 0) {
            StringBuffer buf = new StringBuffer();
            PDELabelProvider labelProvider = new PDELabelProvider();
            int maxCount = 10;
            for (Iterator<Object> iterator = problemModels.iterator(); iterator.hasNext();) {
                buf.append(labelProvider.getText(iterator.next()));
                buf.append('\n');
                maxCount--;
                if (maxCount <= 0) {
                    buf.append(Dialog.ELLIPSIS);
                    break;
                }
            }

            MessageDialogWithToggle dialog = MessageDialogWithToggle.openOkCancelConfirm(getShell(),
                    PDEUIMessages.AntGeneratingExportWizard_0,
                    MessageFormat.format(PDEUIMessages.AntGeneratingExportWizard_1,
                            new Object[] { buf.toString() }),
                    PDEUIMessages.AntGeneratingExportWizard_2, false,
                    PDEPlugin.getDefault().getPreferenceStore(),
                    IPreferenceConstants.OVERWRITE_BUILD_FILES_ON_EXPORT);
            if (dialog.getReturnCode() == Window.CANCEL) {
                return false;
            }
        }
    }
    if (fPage.doGenerateAntFile())
        generateAntBuildFile(fPage.getAntBuildFileName());
    return true;
}