List of usage examples for org.eclipse.jface.preference IPreferenceStore setValue
void setValue(String name, boolean value);
From source file:com.nokia.tools.screen.ui.dialogs.PathHandlingConfig.java
License:Open Source License
public void saveRecentPathList() { IPreferenceStore iStore = UtilsPlugin.getDefault().getPreferenceStore(); int i = 0;/*from w w w . j av a 2 s . c o m*/ for (String p : recentPathList) { iStore.setValue(PREF_ADD_RECENTLY + i++, p); } }
From source file:com.nokia.tools.screen.ui.views.ResourcePage.java
License:Open Source License
@Override public void init(IPageSite pageSite) { super.init(pageSite); boolean syncState = false; // selection listener for synchronizing resource view with selection in // editor//from ww w . ja v a 2s .co m synchronizeListener = new ISelectionListener() { public void selectionChanged(IWorkbenchPart part, ISelection selection) { if (suppressViewerEvents) { return; } if (part == editorPart || (part instanceof ContentOutlineViewPart)) { showSelection((IStructuredSelection) selection); } } }; // --------------------------------- // contribute toolbar toggle buttons // --------------------------------- IToolBarManager bars = pageSite.getActionBars().getToolBarManager(); Action toggleSync = new WorkbenchPartAction(null, WorkbenchPartAction.AS_CHECK_BOX) { public void run() { if (synchronize) { synchronize = false; getSite().getPage().getWorkbenchWindow().getSelectionService() .removeSelectionListener(synchronizeListener); } else { synchronize = true; getSite().getPage().getWorkbenchWindow().getSelectionService() .addSelectionListener(synchronizeListener); IEditorSite site = getSite().getPage().getActiveEditor().getEditorSite(); if (site == null || site.getSelectionProvider() == null) { // can happen when the editor failed to initialize return; } ISelection selection = site.getSelectionProvider().getSelection(); IStructuredSelection sel = (IStructuredSelection) selection; if (sel != null) { Object o = sel.getFirstElement(); if (o instanceof IContentData || o instanceof EditPart) showSelection(sel); } } IPreferenceStore store = UiPlugin.getDefault().getPreferenceStore(); store.setValue(IIDEConstants.PREF_SYNC_WITH_EDITOR, synchronize); } @Override protected boolean calculateEnabled() { return true; } }; ImageDescriptor i1 = UiPlugin.getIconImageDescriptor("resview_toggle_synch.gif", true); toggleSync.setToolTipText(ViewMessages.ResView_toggleSync_tooltip); toggleSync.setImageDescriptor(i1); bars.add(toggleSync); // Restore last syncronization state IPreferenceStore store = UiPlugin.getDefault().getPreferenceStore(); syncState = store.getBoolean(IIDEConstants.PREF_SYNC_WITH_EDITOR); synchronize = !syncState; toggleSync.setChecked(syncState); toggleSync.run(); }
From source file:com.nokia.tools.theme.s60.cstore.ComponentPoolConfig.java
License:Open Source License
public void save() { IPreferenceStore iStore = UtilsPlugin.getDefault().getPreferenceStore(); iStore.setValue(PREF_ADD_EXAMPLES, addExampleThemes); iStore.setValue(PREF_ADD_OPEN_TH, addOpenThemes); iStore.setValue(PREF_ADD_WSPACE_TH, addWorkspaceTheme); iStore.setValue(PREF_ADD_CUSTOM_TH, addCustomThemes); iStore.setValue(PREF_ADD_USERTHEMECOUNT, userThemeList.size()); int c = 0;//from ww w. j av a2 s . c o m for (String p : userThemeList) { iStore.setValue(PREF_ADD_USERTHEME_BASE + c++, p); } }
From source file:com.nokia.tools.theme.s60.ui.wizards.ExportThemeOperation.java
License:Open Source License
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { if (monitor instanceof SubProgressMonitor) { monitor = ((SubProgressMonitor) monitor).getWrappedProgressMonitor(); }//from w w w. j a v a 2s .c o m if (monitor != null) { monitor.beginTask("Exporting " + tName + "...", IProgressMonitor.UNKNOWN); } try { tempDirectory = FileUtils.getTemporaryDirectory() + File.separator + "tmpExport"; File tmpDirFile = new File(tempDirectory); while (tmpDirFile.exists()) { tempDirectory = FileUtils.getTemporaryDirectory() + File.separator + "tmpExport" + new Random().nextInt(); tmpDirFile = new File(tempDirectory); } tmpDirFile = new File(tempDirectory); // create it tmpDirFile.mkdir(); if (TPF.equals(exportType)) { exportType = ZIP; } if (TPF.equals(exportType)) { // find directory that contains TDF file IContainer tdfContainer = findTdf(source); processDir(tempDirectory, tdfContainer); } else { // step two - resursively process all resources in project processDir(tempDirectory, source); } if (monitor != null) monitor.worked(1); // adjust .project - remove linked resources removeLinkedResources(tempDirectory); // adjust .project - update theme name updateThemeName(tempDirectory, tName); URL iconUrl = ThirdPartyIconManager.getToolSpecificThirdPartyIconUrl(); if (iconUrl != null) { try { InputStream in = iconUrl.openStream(); FileUtils.copyFile(in, new File(tempDirectory + File.separator + TOOL_SPECIFIC_TPI_FILENAME)); in.close(); } catch (Exception e) { } } if (monitor != null) monitor.worked(1); if (!DIR.equals(exportType)) { // pack this to target dir packDirectoryToFile(tempDirectory, target, source.getName()); } else { // copy temp dir to target /*FileUtils.copyDir(new File(tempDirectory), new File(target + File.separator + source.getName()));*/ FileUtils.copyDirNIO(new File(tempDirectory), new File(target + File.separator + source.getName())); } if (monitor != null) monitor.worked(1); } catch (Exception e) { e.printStackTrace(); } finally { FileUtils.deleteDirectory(new File(tempDirectory)); if (monitor != null) monitor.worked(1); } try { // remember target dir IPreferenceStore iPreferenceStore = UtilsPlugin.getDefault().getPreferenceStore(); if (!new File(target).isDirectory()) target = new File(target).getParent(); iPreferenceStore.setValue(PREF_LAST_EXPORT_LOCATION, target); } catch (Exception e) { } }
From source file:com.nokia.tools.theme.ui.dialogs.SVG2BitmapConversionConfirmationDialog.java
License:Open Source License
/** * @see org.eclipse.jface.dialogs.Dialog# * createDialogArea(org.eclipse.swt.widgets.Composite) Here we fill the * center area of the dialog// w w w . j av a 2 s . co m */ protected Control createDialogArea(Composite parent) { PlatformUI.getWorkbench().getHelpSystem().setHelp(parent.getParent(), SVG2BitmapConversionConfirmationDialog.CONVERSION_CONFIRMATION_DIALOG_CONTEXT); Composite area = (Composite) super.createDialogArea(parent); Composite container = new Composite(area, SWT.NONE); container.setLayoutData(new GridData(GridData.FILL_BOTH)); GridLayout layout = new GridLayout(); container.setLayout(layout); layout.marginHeight = 13; layout.marginWidth = 13; layout.verticalSpacing = 7; setTitle(Messages.SVGConversionConfirmDialog_banner_title); setMessage(Messages.SVGConversionConfirmDialog_banner_message); IBrandingManager manager = BrandingExtensionManager.getBrandingManager(); if (manager != null) { Image titleAreaImage = manager.getBannerImageDescriptor( Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/wizban/convert_edit_bmp.png")) .createImage(); setTitleImage(titleAreaImage); forDispose.add(titleAreaImage); } Composite spinners = new Composite(container, SWT.NONE); layout = new GridLayout(5, false); spinners.setLayout(layout); layout.marginHeight = 0; layout.marginWidth = 0; Label l = new Label(spinners, SWT.NONE); l.setText(Messages.SVGConversionConfirmDialog_text2); width = new Spinner(spinners, SWT.BORDER); width.setMinimum(1); width.setMaximum(999); GridData gd = new GridData(); gd.widthHint = 30; width.setLayoutData(gd); width.setSelection(bounds.width); Label x = new Label(spinners, SWT.NONE); x.setText(" x "); height = new Spinner(spinners, SWT.BORDER); height.setMinimum(1); height.setMaximum(999); gd = new GridData(); gd.widthHint = 30; height.setLayoutData(gd); height.setSelection(bounds.height); x = new Label(spinners, SWT.NONE); x.setText(Messages.SVGConversionConfirmDialog_pixelsLabel); // preserve mask check final Button maskCheck = new Button(container, SWT.CHECK); maskCheck.setText(Messages.SVGConversionConfirmDialog_maskCheckLabel); maskCheck.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { boolean state = maskCheck.getSelection(); maskPreserve = state; IPreferenceStore iPreferenceStore = UtilsPlugin.getDefault().getPreferenceStore(); iPreferenceStore.setValue(IMediaConstants.PREF_SVG_CONVERSION_PRESERVE_MASK, state + ""); } public void widgetDefaultSelected(SelectionEvent e) { } }); maskCheck.setToolTipText(Messages.SVGConversionConfirmDialog_maskCheckTooltip); // default IPreferenceStore iPreferenceStore = UtilsPlugin.getDefault().getPreferenceStore(); if (StringUtils.isEmpty(iPreferenceStore.getString(IMediaConstants.PREF_SVG_CONVERSION_PRESERVE_MASK))) { maskCheck.setSelection(true); } else { maskCheck.setSelection(iPreferenceStore.getBoolean(IMediaConstants.PREF_SVG_CONVERSION_PRESERVE_MASK)); } if (!supportMask) { maskCheck.setEnabled(false); maskCheck.setSelection(false); } maskPreserve = maskCheck.getSelection(); // don't ask again check final Button check = new Button(container, SWT.CHECK); check.setText(Messages.SVGConversionConfirmDialog_dontAskAgain); check.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { boolean state = check.getSelection(); if (state) { width.setEnabled(false); width.setSelection(bounds.width); height.setEnabled(false); height.setSelection(bounds.width); } else { width.setEnabled(true); height.setEnabled(true); } IPreferenceStore iPreferenceStore = UtilsPlugin.getDefault().getPreferenceStore(); iPreferenceStore.setValue(IMediaConstants.PREF_SILENT_SVG_CONVERSION, state); } public void widgetDefaultSelected(SelectionEvent e) { } }); check.setToolTipText(Messages.SVGConversionConfirmDialog_checkTooltip); check.setEnabled(rc); Composite container2 = new Composite(area, SWT.NONE); container2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); layout = new GridLayout(); container2.setLayout(layout); layout.marginHeight = 0; layout.marginWidth = 0; layout.verticalSpacing = 0; final Label separator = new Label(container2, SWT.SEPARATOR | SWT.HORIZONTAL); separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); return area; }
From source file:com.nokia.tools.theme.ui.dialogs.ThemeResourceSelectionPage.java
License:Open Source License
public void dispose() { IPreferenceStore iPreferenceStore = UtilsPlugin.getDefault().getPreferenceStore(); int i = 0;/*from w w w . j a v a 2 s. c o m*/ for (String p : suggestionsAndHistory) { iPreferenceStore.setValue(IScreenConstants.PREF_ADD_FILTER_HISTORY + i++, p); } iPreferenceStore.setValue(IScreenConstants.PREF_FILTER_HISTORY_COUNT, i); iPreferenceStore.setValue(IScreenConstants.PREF_LAST_COLUMNRATIO_THEME_RESOURCE_PAGE, columnRatio); }
From source file:com.nokia.tools.ui.dialog.ChooseProgramDialog.java
License:Open Source License
@Override protected Control createDialogArea(final Composite parent) { prgmDesList = new ArrayList<ProgramDescriptor>( Arrays.asList(RegQueryUtil.getRecommendedPrograms(fileExtn))); final ProgramDescriptor initialPgm = addProgram(initialProgram); final Composite area = (Composite) super.createDialogArea(parent); setTitle(getTitle());/*w ww . ja v a 2s. c o m*/ if (bannerMessage != null) { setMessage(bannerMessage); } else { setMessage(Messages.Choose_Program_To_Open); } Composite rootArea = new Composite(area, SWT.NONE); GridData gd = new GridData(GridData.FILL, GridData.FILL, true, true); rootArea.setLayoutData(gd); GridLayout gl = new GridLayout(1, false); gl.marginHeight = 13; gl.marginWidth = 13; gl.verticalSpacing = 7; rootArea.setLayout(gl); groupArea = new Group(rootArea, SWT.NONE); groupArea.setText(Messages.Program); gd = new GridData(GridData.FILL, GridData.FILL, true, true); groupArea.setLayoutData(gd); gl = new GridLayout(2, false); gl.marginHeight = 9; gl.marginWidth = 9; gl.verticalSpacing = 7; groupArea.setLayout(gl); tableViewer = new TableViewer(groupArea, SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL); final Table items = tableViewer.getTable(); items.setLinesVisible(false); items.setHeaderVisible(false); gd = new GridData(SWT.FILL, SWT.FILL, true, true); gd.minimumHeight = 50; gd.minimumWidth = 100; gd.widthHint = 250; gd.heightHint = 100; gd.horizontalSpan = 2; items.setLayoutData(gd); tableViewer.setLabelProvider(new ProgramLabelProvider()); tableViewer.setContentProvider(new ArrayContentProvider()); IPreferenceStore oldStore = UIPreferences.getStore(); String allEditors = oldStore.getString(fileExtn); if (!StringUtils.isEmpty(allEditors)) { String[] editors = allEditors.split(","); for (String editor : editors) { addProgram(editor); } } tableViewer.setInput(prgmDesList); if (initialPgm != null) { tableViewer.setSelection(new StructuredSelection(initialPgm)); } else { tableViewer.setSelection(new StructuredSelection(tableViewer.getElementAt(0))); } if (showAlwaysUseMessage) { checkAlways = new Button(groupArea, SWT.CHECK); checkAlways.setText("Always use the selected program to open this kind of file"); gd = new GridData(SWT.FILL, SWT.NONE, true, false); gd.horizontalSpan = 2; checkAlways.setLayoutData(gd); } btnBrowse = new Button(groupArea, SWT.NONE); btnBrowse.setText("&Browse..."); initializeDialogUnits(btnBrowse); setButtonLayoutData(btnBrowse); gd = (GridData) btnBrowse.getLayoutData(); gd.horizontalSpan = 2; gd.horizontalAlignment = SWT.RIGHT; btnBrowse.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent se) { final FileDialog fd = new FileDialog(new Shell(), SWT.SYSTEM_MODAL | SWT.OPEN); fd.setFilterExtensions(externalToolFilter); if (initialProgram != "") { fd.setFileName(initialProgram); } final String text = fd.open(); if (text != null) { final ProgramDescriptor des = addProgram(text); if (des != null) { selectedProgram = des; tableViewer.setInput(prgmDesList); tableViewer.setSelection(new StructuredSelection(des)); } IPreferenceStore store = UIPreferences.getStore(); String temp = store.getString(fileExtn); if (!StringUtils.isEmpty(temp)) { if (!temp.contains(des.getFullPath())) { String allEditors = temp + ',' + des.getFullPath(); store.setValue(fileExtn, allEditors); } } else { store.setValue(fileExtn, des.getFullPath()); } } } }); Composite separatorComposite = new Composite(area, SWT.NONE); separatorComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); GridLayout layout3 = new GridLayout(); separatorComposite.setLayout(layout3); layout3.numColumns = 1; layout3.marginHeight = 0; layout3.marginWidth = 0; layout3.verticalSpacing = 0; final Label separator = new Label(separatorComposite, SWT.SEPARATOR | SWT.HORIZONTAL); gd = new GridData(GridData.FILL_HORIZONTAL); separator.setLayoutData(gd); return area; }
From source file:com.nokia.tools.ui.dialog.PathHandlingConfig.java
License:Open Source License
public void save() { IPreferenceStore iStore = Activator.getDefault().getPreferenceStore(); iStore.setValue(PREF_USE_PREDEFINED, usePredefined); iStore.setValue(PREF_PREDEFINED_COUNT, predefinedPathList.size()); iStore.setValue(PREF_RECENT_COUNT, recentCount); int i = 0;// w w w .ja va2 s .c o m for (String p : predefinedPathList) { iStore.setValue(PREF_ADD_PREDEFINED + i++, p); } }
From source file:com.nokia.tools.ui.dialog.PathHandlingConfig.java
License:Open Source License
public void saveRecentPathList() { IPreferenceStore iStore = Activator.getDefault().getPreferenceStore(); int i = 0;//from www. jav a 2 s . c o m for (String p : recentPathList) { iStore.setValue(PREF_ADD_RECENTLY + i++, p); } }
From source file:com.nokia.tools.ui.dialog.ResourceSelectionDialog.java
License:Open Source License
@Override public boolean close() { Shell shell = this.getShell(); IPreferenceStore store = UIPreferences.getStore(); if (getCurrentPage() != null) { store.setValue(UIPreferences.PREF_LAST_ACTIVE_RESOURCE_PAGE, getCurrentPage().getId()); }/*from w w w .jav a2 s . com*/ if (previewArea != null) { store.setValue(UIPreferences.PREF_PREVIEW_SIZE_RESOURCE_PAGE, previewSize); store.setValue(UIPreferences.PREF_LAST_WIDTH_RESOURCE_PAGE, previewArea.getParent().getSize().x); store.setValue(UIPreferences.PREF_LAST_HEIGHT_RESOURCE_PAGE, previewArea.getParent().getSize().y); } store.setValue(UIPreferences.PREF_LAST_XPOS_IMAGESELECTION_DIALOG, shell.getBounds().x); store.setValue(UIPreferences.PREF_LAST_YPOS_IMAGESELECTION_DIALOG, shell.getBounds().y); if (showPreviewHoverCheckBox && previewHoverCheckBox != null) { store.setValue(UIPreferences.PREF_HOVER_ENABLED_RESOURCE_PAGE, previewHoverCheckBox.getSelection()); } if (pages != null) { for (IResourceSelectionPage page : pages) { page.dispose(); } } for (Image image : images) { image.dispose(); } if (previewCanvas != null && previewCanvas.getImage() != null) { previewCanvas.getImage().dispose(); } return super.close(); }