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;
}
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();
}
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());
}
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);
}
}
}
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;
}
Aggregations