Search in sources :

Example 16 with IDialogSettings

use of org.eclipse.jface.dialogs.IDialogSettings in project translationstudio8 by heartsome.

the class KeysPreferencePage method createContents.

@Override
protected Control createContents(Composite parent) {
    PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IWorkbenchHelpContextIds.KEYS_PREFERENCE_PAGE);
    final Composite page = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(1, false);
    layout.marginWidth = 0;
    page.setLayout(layout);
    Group groupParent = new Group(page, SWT.None);
    groupParent.setLayout(new GridLayout());
    groupParent.setLayoutData(new GridData(GridData.FILL_BOTH));
    groupParent.setText(Messages.getString("preferencepage.KeysPreferencePage.groupParent"));
    HsImageLabel imageLabel = new HsImageLabel(Messages.getString("preferencepage.KeysPreferencePage.imageLabel"), Activator.getImageDescriptor(ImageConstant.PREFERENCE_SYS_KEY));
    Composite cmp = imageLabel.createControl(groupParent);
    cmp.setLayout(new GridLayout());
    Composite cmpTemp = (Composite) imageLabel.getControl();
    cmpTemp.setLayoutData(new GridData(GridData.FILL_BOTH));
    Composite cmpContent = new Composite(cmpTemp, SWT.None);
    cmpContent.setLayout(new GridLayout());
    GridData data = new GridData(GridData.FILL_BOTH);
    data.horizontalSpan = 2;
    cmpContent.setLayoutData(data);
    // 不显示过滤文本框
    PlatformUI.getPreferenceStore().setDefault(IWorkbenchPreferenceConstants.SHOW_FILTERED_TEXTS, false);
    IDialogSettings settings = getDialogSettings();
    fPatternFilter = new CategoryPatternFilter(true, commandService.getCategory(null));
    if (settings.get(TAG_FILTER_UNCAT) != null) {
        fPatternFilter.filterCategories(settings.getBoolean(TAG_FILTER_UNCAT));
    }
    createTree(cmpContent);
    fill();
    applyDialogFont(cmpContent);
    imageLabel.computeSize();
    return page;
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) HsImageLabel(net.heartsome.cat.common.ui.HsImageLabel) IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) GridData(org.eclipse.swt.layout.GridData)

Example 17 with IDialogSettings

use of org.eclipse.jface.dialogs.IDialogSettings in project tdi-studio-se by Talend.

the class BusinessInitDiagramFileAction method run.

/**
     * @generated NOT
     */
public void run(IAction action) {
    TransactionalEditingDomain editingDomain = GMFEditingDomainFactory.INSTANCE.createEditingDomain();
    ResourceSet resourceSet = new ResourceSetImpl();
    EObject diagramRoot = null;
    try {
        Resource resource = resourceSet.getResource(URI.createPlatformResourceURI(mySelectedModelFile.getFullPath().toString()), true);
        diagramRoot = (EObject) resource.getContents().get(0);
    } catch (WrappedException ex) {
        BusinessDiagramEditorPlugin.getInstance().logError(Messages.getString("BusinessInitDiagramFileAction.UnableToLoadResource") + mySelectedModelFile.getFullPath().toString(), //$NON-NLS-1$
        ex);
    }
    if (diagramRoot == null) {
        MessageDialog.openError(myPart.getSite().getShell(), Messages.getString("BusinessInitDiagramFileAction.Error"), //$NON-NLS-1$ //$NON-NLS-2$
        Messages.getString("BusinessInitDiagramFileAction.LoadFaild"));
        return;
    }
    Wizard wizard = new BusinessNewDiagramFileWizard(mySelectedModelFile, myPart.getSite().getPage(), mySelection, diagramRoot, editingDomain);
    IDialogSettings pluginDialogSettings = BusinessDiagramEditorPlugin.getInstance().getDialogSettings();
    //$NON-NLS-1$
    IDialogSettings initDiagramFileSettings = pluginDialogSettings.getSection("InisDiagramFile");
    if (initDiagramFileSettings == null) {
        //$NON-NLS-1$
        initDiagramFileSettings = pluginDialogSettings.addNewSection("InisDiagramFile");
    }
    wizard.setDialogSettings(initDiagramFileSettings);
    wizard.setForcePreviousAndNextButtons(false);
    wizard.setWindowTitle(//$NON-NLS-1$ //$NON-NLS-2$
    Messages.getString("BusinessInitDiagramFileAction.IntialNew") + BusinessProcessEditPart.MODEL_ID + Messages.getString("BusinessInitDiagramFileAction.DiagramFile"));
    WizardDialog dialog = new WizardDialog(myPart.getSite().getShell(), wizard);
    dialog.create();
    dialog.getShell().setSize(Math.max(500, dialog.getShell().getSize().x), 500);
    dialog.open();
}
Also used : WrappedException(org.eclipse.emf.common.util.WrappedException) TransactionalEditingDomain(org.eclipse.emf.transaction.TransactionalEditingDomain) ResourceSetImpl(org.eclipse.emf.ecore.resource.impl.ResourceSetImpl) IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) EObject(org.eclipse.emf.ecore.EObject) Resource(org.eclipse.emf.ecore.resource.Resource) ResourceSet(org.eclipse.emf.ecore.resource.ResourceSet) Wizard(org.eclipse.jface.wizard.Wizard) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Example 18 with IDialogSettings

use of org.eclipse.jface.dialogs.IDialogSettings in project tdi-studio-se by Talend.

the class ToggleOrientationAction method storeCheckState.

/**
     * Stores the check state.
     */
private void storeCheckState() {
    IDialogSettings settings = Activator.getDefault().getDialogSettings(DIALOG_SETTINGS_NAME);
    String key = sashForm.getClass().getCanonicalName();
    settings.put(key, orientation.name());
}
Also used : IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings)

Example 19 with IDialogSettings

use of org.eclipse.jface.dialogs.IDialogSettings in project tdi-studio-se by Talend.

the class SetSubstitutionAction method run.

@Override
public void run() {
    TreeNode treeNode = null;
    boolean needWarning = false;
    if (input) {
        treeNode = XmlmapFactory.eINSTANCE.createTreeNode();
        if (!selectedNode.getOutgoingConnections().isEmpty()) {
            needWarning = true;
        }
    } else {
        treeNode = XmlmapFactory.eINSTANCE.createOutputTreeNode();
        EList<Connection> incomingConnections = selectedNode.getIncomingConnections();
        if (!incomingConnections.isEmpty()) {
            needWarning = true;
        }
    }
    boolean canContinue = true;
    // Shell shell = this.part.getSite().getShell();
    if (needWarning) {
        canContinue = MessageDialog.openConfirm(null, "Warning", "Do you want to disconnect the existing linker and then add a choice for the selected element ?");
    }
    if (canContinue) {
        AbstractUIPlugin plugin = (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID);
        IDialogSettings workbenchSettings = plugin.getDialogSettings();
        //$NON-NLS-1$
        IDialogSettings section = workbenchSettings.getSection("SetSubstitutionAction.SubsMessageDialog");
        if (section == null) {
            //$NON-NLS-1$
            section = workbenchSettings.addNewSection("SetSubstitutionAction.SubsMessageDialog");
        }
        boolean popupMessageDialog = !section.getBoolean(HIDE_MESSAGE);
        if (popupMessageDialog) {
            String message = "This element will be copied as part of the substitution group automatically." + "\n" + "If this element must be abstract and must be extended only, you can delete it.";
            SubsMessageDialog dialog = new SubsMessageDialog(null, message);
            int open = dialog.open();
            if (open == Window.OK) {
                boolean hideDialogNextTime = dialog.getResult();
                if (hideDialogNextTime) {
                    section.put(HIDE_MESSAGE, true);
                }
            }
            if (open == Window.CANCEL) {
                return;
            }
        }
        XmlMapUtil.detachNodeConnections(selectedNode, mapperManager.getExternalData(), false);
        treeNode.setName(selectedNode.getName() + XSDPopulationUtil2.SUBS);
        treeNode.setNodeType(NodeType.ELEMENT);
        treeNode.setXpath(selectedNode.getXpath() + XmlMapUtil.XPATH_SEPARATOR + treeNode.getName());
        treeNode.setSubstitution(true);
        TreeNode parentNode = (TreeNode) selectedNode.eContainer();
        int index = parentNode.getChildren().indexOf(selectedNode);
        parentNode.getChildren().remove(selectedNode);
        treeNode.getChildren().add(selectedNode);
        parentNode.getChildren().add(index, treeNode);
        if (!input) {
            OutputTreeNode output = (OutputTreeNode) selectedNode;
            if (!XmlMapUtil.isExpressionEditable(output) && output.isAggregate()) {
                output.setAggregate(false);
            }
        }
        Object object = graphicViewer.getEditPartRegistry().get(treeNode);
        if (object instanceof TreeNodeEditPart) {
            graphicViewer.select((TreeNodeEditPart) object);
        }
    }
}
Also used : AbstractUIPlugin(org.eclipse.ui.plugin.AbstractUIPlugin) IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) TreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode) Connection(org.talend.designer.xmlmap.model.emf.xmlmap.Connection) OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) TreeNodeEditPart(org.talend.designer.xmlmap.parts.TreeNodeEditPart)

Example 20 with IDialogSettings

use of org.eclipse.jface.dialogs.IDialogSettings in project tdi-studio-se by Talend.

the class ConfigureCpuProfilerAction method doConfigure.

/**
     * Configures the profiler.
     * 
     * @param monitor The progress monitor
     * @param dialog The configuration dialog
     * @return The status
     */
IStatus doConfigure(IProgressMonitor monitor, ConfigurationDialog dialog) {
    IActiveJvm jvm = cpuSection.getJvm();
    if (jvm == null) {
        return Status.CANCEL_STATUS;
    }
    IDialogSettings dialogSettings = Activator.getDefault().getDialogSettings(CpuSection.class.getName());
    ProfilerType type = dialog.getProfilerType();
    if (jvm.getCpuProfiler().getProfilerType() != type) {
        if (jvm.getCpuProfiler().getState() == ProfilerState.RUNNING) {
            new SuspendCpuProfilingAction(cpuSection).run();
        }
        new ClearCpuProfilingDataAction(cpuSection).run();
        jvm.getCpuProfiler().setProfilerType(type);
    }
    if (type == ProfilerType.SAMPLING) {
        int samplingPeriod = dialog.getSamplingPeriod();
        jvm.getCpuProfiler().setSamplingPeriod(samplingPeriod);
        dialogSettings.put(IConstants.PROFILER_SAMPLING_PERIOD_KEY, samplingPeriod);
    }
    String packageString = setPackages(dialog.getPackages(), monitor);
    dialogSettings.put(IConstants.PACKAGES_KEY, packageString);
    dialogSettings.put(IConstants.PROFILER_TYPE_KEY, type.name());
    return Status.OK_STATUS;
}
Also used : IActiveJvm(org.talend.designer.runtime.visualization.IActiveJvm) IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) CpuSection(org.talend.designer.runtime.visualization.internal.ui.properties.cpu.CpuSection) ProfilerType(org.talend.designer.runtime.visualization.internal.core.cpu.ICpuProfiler.ProfilerType)

Aggregations

IDialogSettings (org.eclipse.jface.dialogs.IDialogSettings)81 File (java.io.File)9 ArrayList (java.util.ArrayList)6 PersistenceException (org.talend.commons.exception.PersistenceException)6 Point (org.eclipse.swt.graphics.Point)5 Path (org.eclipse.core.runtime.Path)4 MenuItem (org.eclipse.swt.widgets.MenuItem)4 IPath (org.eclipse.core.runtime.IPath)3 SelectionEvent (org.eclipse.swt.events.SelectionEvent)3 GridData (org.eclipse.swt.layout.GridData)3 Combo (org.eclipse.swt.widgets.Combo)3 Composite (org.eclipse.swt.widgets.Composite)3 FileDialog (org.eclipse.swt.widgets.FileDialog)3 Widget (org.eclipse.swt.widgets.Widget)3 LocalFile (org.eclipse.core.internal.filesystem.local.LocalFile)2 IFile (org.eclipse.core.resources.IFile)2 CoreException (org.eclipse.core.runtime.CoreException)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 IJobChangeEvent (org.eclipse.core.runtime.jobs.IJobChangeEvent)2 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)2