use of org.eclipse.jface.preference.IPreferenceStore in project tdi-studio-se by Talend.
the class AbstractLanguageMemoController method estimateRowSize.
/*
* (non-Javadoc)
*
* @see
* org.talend.designer.core.ui.editor.properties.controllers.AbstractElementPropertySectionController#estimateRowSize
* (org.eclipse.swt.widgets.Composite, org.talend.core.model.process.IElementParameter)
*/
@Override
public int estimateRowSize(Composite subComposite, IElementParameter param) {
if (!estimateInitialized) {
IControlCreator txtCtrl = new IControlCreator() {
@Override
public Control createControl(final Composite parent, final int style) {
final ColorStyledText colorText = new ColorStyledText(parent, style, CorePlugin.getDefault().getPreferenceStore(), language);
Display display = Display.getCurrent();
if (display == null) {
display = Display.getDefault();
}
if (display != null) {
display.syncExec(new Runnable() {
@Override
public void run() {
IPreferenceStore preferenceStore = CorePlugin.getDefault().getPreferenceStore();
String fontType = preferenceStore.getString(TalendDesignerPrefConstants.MEMO_TEXT_FONT);
FontData fontData = new FontData(fontType);
Font font = new Font(parent.getDisplay(), fontData);
addResourceDisposeListener(colorText, font);
colorText.setFont(font);
}
});
}
return colorText;
}
};
DecoratedField dField = null;
if (param.getNbLines() != 1) {
dField = new DecoratedField(subComposite, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.WRAP, txtCtrl);
} else {
dField = new DecoratedField(subComposite, SWT.BORDER | SWT.WRAP, txtCtrl);
}
StyledText text = (StyledText) dField.getControl();
FormData d = (FormData) text.getLayoutData();
d.height = text.getLineHeight();
text.getParent().setSize(subComposite.getSize().x, text.getLineHeight());
rowSizeByLine = text.getLineHeight();
Point initialSize = dField.getLayoutControl().computeSize(SWT.DEFAULT, SWT.DEFAULT);
dField.getLayoutControl().dispose();
rowSizeFixed = ITabbedPropertyConstants.VSPACE + (initialSize.y - rowSizeByLine);
estimateInitialized = true;
}
return rowSizeFixed + (rowSizeByLine * param.getNbLines());
}
use of org.eclipse.jface.preference.IPreferenceStore in project tdi-studio-se by Talend.
the class ExchangeLoginTask method run.
/* (non-Javadoc)
* @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
if (!PluginChecker.isExchangeSystemLoaded() || TalendPropertiesUtil.isHideExchange()) {
return;
}
Job job = new //$NON-NLS-1$
Job(//$NON-NLS-1$
"Check Exchange") {
@Override
protected IStatus run(IProgressMonitor monitor) {
// check for Talendforge
IPreferenceStore prefStore = PlatformUI.getPreferenceStore();
boolean checkTisVersion = prefStore.getBoolean(ITalendCorePrefConstants.EXCHANGE_CHECK_TIS_VERSION);
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
if (!checkTisVersion && brandingService.isPoweredbyTalend()) {
int count = prefStore.getInt(TalendForgeDialog.LOGINCOUNT);
if (count < 0) {
count = 1;
}
ExchangeUser exchangeUser = ProjectManager.getInstance().getCurrentProject().getExchangeUser();
//$NON-NLS-1$
boolean isExchangeLogon = exchangeUser.getLogin() != null && !exchangeUser.getLogin().equals("");
boolean isUserPassRight = true;
if (isExchangeLogon) {
IExchangeService service = (IExchangeService) GlobalServiceRegister.getDefault().getService(IExchangeService.class);
if (service.checkUserAndPass(exchangeUser.getUsername(), exchangeUser.getPassword()) != null) {
isUserPassRight = false;
}
}
if (!isExchangeLogon || !isUserPassRight) {
if ((count + 1) % 4 == 0) {
// if (Platform.getOS().equals(Platform.OS_LINUX)) {
// TalendForgeDialog tfDialog = new TalendForgeDialog(this.getShell(), project);
// tfDialog.open();
// } else {
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
Project project = ProjectManager.getInstance().getCurrentProject();
String userEmail = null;
if (project.getAuthor() != null) {
userEmail = project.getAuthor().getLogin();
}
TalendForgeDialog tfDialog = new TalendForgeDialog(DisplayUtils.getDefaultShell(), userEmail);
tfDialog.setBlockOnOpen(true);
tfDialog.open();
}
});
}
prefStore.setValue(TalendForgeDialog.LOGINCOUNT, count + 1);
}
}
return org.eclipse.core.runtime.Status.OK_STATUS;
}
};
job.setSystem(true);
job.setUser(false);
job.setPriority(Job.INTERACTIVE);
// start as soon as possible
job.schedule();
}
use of org.eclipse.jface.preference.IPreferenceStore in project tdi-studio-se by Talend.
the class TalendEditorPaletteFactory method loadFamilyState.
/**
* DOC nrousseau Comment method "loadFamilyState".
*
* @param family
* @return
*/
private static int loadFamilyState(String family) {
IPreferenceStore preferenceStore = DesignerPlugin.getDefault().getPreferenceStore();
preferenceStore.setDefault(PALETTE_STATE + family, PaletteDrawer.INITIAL_STATE_CLOSED);
return preferenceStore.getInt(PALETTE_STATE + family);
}
use of org.eclipse.jface.preference.IPreferenceStore in project tdi-studio-se by Talend.
the class TalendEditorPaletteFactory method createEntryFrom.
public static TalendCombinedTemplateCreationEntry createEntryFrom(IComponent component) {
if (component == null) {
return null;
}
String name = component.getName();
ImageDescriptor imageSmall = component.getIcon16();
IPreferenceStore store = DesignerPlugin.getDefault().getPreferenceStore();
ImageDescriptor imageLarge;
final String string = store.getString(TalendDesignerPrefConstants.LARGE_ICONS_SIZE);
if (string.equals("24")) {
//$NON-NLS-1$
imageLarge = component.getIcon24();
} else {
imageLarge = component.getIcon32();
}
TalendCombinedTemplateCreationEntry newEntry = new TalendCombinedTemplateCreationEntry(name, name, Node.class, component, imageSmall, imageLarge);
newEntry.setDescription(component.getLongName());
return newEntry;
}
use of org.eclipse.jface.preference.IPreferenceStore in project tdi-studio-se by Talend.
the class DownloadCheckUpdatesDialog method createDialogArea.
/**
* Create contents of the dialog.
*
* @param parent
*/
@Override
protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
Composite composite = new Composite(container, SWT.NONE);
composite.setLayout(new GridLayout(2, false));
GridData gd_composite = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_composite.heightHint = 188;
gd_composite.widthHint = 423;
composite.setLayoutData(gd_composite);
Label lblNewLabel = new Label(composite, SWT.NONE);
GridData gd_lblNewLabel = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
gd_lblNewLabel.heightHint = 92;
gd_lblNewLabel.widthHint = 406;
lblNewLabel.setLayoutData(gd_lblNewLabel);
lblNewLabel.setText("\nThere are newer versions of some items you have downloaded\nfrom the Talend Exchange.");
Label lblNewLabel_1 = new Label(composite, SWT.NONE);
lblNewLabel_1.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
lblNewLabel_1.setText("Total available updates : ");
new Label(composite, SWT.NONE);
new Label(composite, SWT.NONE);
new Label(composite, SWT.NONE);
new Label(composite, SWT.NONE);
Button btnCheckButton = new Button(composite, SWT.CHECK);
btnCheckButton.setText("Don't ask again ");
new Label(composite, SWT.NONE);
btnCheckButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
IPreferenceStore prefStore = PlatformUI.getPreferenceStore();
prefStore.setValue(ITalendCorePrefConstants.EXCHANGE_DOWNLOADED_CHECK_UPDATES, true);
cancelPressed();
}
});
return container;
}
Aggregations