List of usage examples for org.eclipse.jface.preference PreferenceDialog open
public int open()
From source file:org.apache.felix.sigil.eclipse.ui.internal.editors.project.ResourceBuildSection.java
License:Apache License
@Override protected void createSection(Section section, FormToolkit toolkit) { setTitle("Resources"); Composite body = createTableWrapBody(1, toolkit); toolkit.createLabel(body, "Specify which resources are included in the bundle."); tree = toolkit.createTree(body, SWT.CHECK | SWT.BORDER); Link link = new Link(body, SWT.WRAP); link.setText(/*from w w w. jav a 2 s. c om*/ "Some resources may be filtered according to preferences. <a href=\"excludedResourcePrefs\">Click here</a> to edit the list of exclusions."); TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB); data.heightHint = 200; tree.setLayoutData(data); viewer = new CheckboxTreeViewer(tree); IProject base = getProjectModel().getProject(); viewer.setContentProvider(new BaseWorkbenchContentProvider()); viewer.setLabelProvider(new WorkbenchLabelProvider()); viewer.addCheckStateListener(this); resourcesFilter = new ExcludedResourcesFilter(); viewer.addFilter(resourcesFilter); viewer.setInput(base); link.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { if ("excludedResourcePrefs".equals(event.text)) { PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn( getPage().getEditorSite().getShell(), SigilCore.EXCLUDED_RESOURCES_PREFERENCES_ID, null, null); dialog.open(); } } }); SigilCore.getDefault().getPreferenceStore().addPropertyChangeListener(this); startWorkspaceListener(base.getWorkspace()); }
From source file:org.apache.felix.sigil.ui.eclipse.ui.preferences.project.ProjectPropertyPage.java
License:Apache License
@Override protected Control createContents(Composite parent) { final Composite control = new Composite(parent, SWT.NONE); projectSpecificBtn = new Button(control, SWT.CHECK); projectSpecificBtn.setText("Enable project specific settings"); projectSpecificBtn.addSelectionListener(new SelectionAdapter() { @Override/*from w ww. j a v a 2s.com*/ public void widgetSelected(SelectionEvent e) { setProjectSpecific(!projectSpecific); } }); Label link = new Label(control, SWT.UNDERLINE_SINGLE); link.addMouseListener(new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(null, SigilCore.REPOSITORIES_PREFERENCES_ID, null, null); dialog.open(); } }); link.setText("Configure workspace settings"); settings = new Composite(control, SWT.BORDER); settings.setLayout(new GridLayout(1, false)); createSettings(settings); setFonts(control); // layout control.setLayout(new GridLayout(2, false)); projectSpecificBtn.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); settings.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1)); // load settings String currentSet = getCurrentSet(); if (currentSet == null) { setProjectSpecific(false); } else { setView.setSelection(new StructuredSelection(currentSet)); setProjectSpecific(true); } return control; }
From source file:org.apache.ivyde.internal.eclipse.ui.AbstractSetupTab.java
License:Apache License
public AbstractSetupTab(final TabFolder tabs, String title, final String preferencePageId, IProject project) { TabItem tab = new TabItem(tabs, SWT.NONE); tab.setText(title);/*from w ww. j a v a2 s .co m*/ Composite composite = new Composite(tabs, SWT.NONE); composite.setLayout(new GridLayout()); composite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); Composite headerComposite = new Composite(composite, SWT.NONE); headerComposite.setLayout(new GridLayout(2, false)); headerComposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false)); projectSpecificButton = new Button(headerComposite, SWT.CHECK); projectSpecificButton.setText("Enable project specific settings"); projectSpecificButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { projectSpecificChanged(); } }); mainGeneralSettingsLink = new Link(headerComposite, SWT.NONE); mainGeneralSettingsLink.setFont(headerComposite.getFont()); mainGeneralSettingsLink.setText("<A>Configure Workspace Settings...</A>"); mainGeneralSettingsLink.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(tabs.getShell(), preferencePageId, null, null); dialog.open(); } }); mainGeneralSettingsLink.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false)); Label horizontalLine = new Label(headerComposite, SWT.SEPARATOR | SWT.HORIZONTAL); horizontalLine.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1)); // CheckStyle:MagicNumber| OFF Composite configComposite = new Composite(composite, SWT.NONE); configComposite.setLayout(new GridLayout()); configComposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); setupEditor = createSetupEditor(configComposite, project); tab.setControl(composite); }
From source file:org.apache.sling.ide.eclipse.ui.propertyPages.SlingProjectPropertyPage.java
License:Apache License
public static void openPropertyDialog(Shell shell, IProject project) { // find out if the override page is contributed, and show that instead of the default one // TODO - stop relying on internals PropertyPageManager pageManager = new PropertyPageManager(); PropertyPageContributorManager.getManager().contribute(pageManager, project); List<?> nodes = pageManager.getElements(PreferenceManager.PRE_ORDER); boolean overridePresent = false; for (Object node : nodes) { if (((IPreferenceNode) node).getId().equals(PAGE_ID_OVERRIDE)) { overridePresent = true;/*from w w w .j a va 2 s . com*/ break; } } String pageId = overridePresent ? PAGE_ID_OVERRIDE : PAGE_ID; PreferenceDialog dialog = PreferencesUtil.createPropertyDialogOn(shell, project, pageId, new String[] { pageId }, null); dialog.open(); }
From source file:org.archicontribs.modelrepository.actions.CommitModelAction.java
License:Open Source License
@Override public void run() { if (!GraficoUtils.isModelLoaded(getGitRepository())) { MessageDialog.openInformation(fWindow.getShell(), "Commit", "Model is not open. Hit Refresh!"); return;//w w w .j av a 2s.com } boolean doCommit = MessageDialog.openConfirm(fWindow.getShell(), "Commit", "Commit changes?"); if (doCommit) { IArchimateModel model = GraficoUtils.locateModel(getGitRepository()); if (model != null) { try { String userName = ModelRepositoryPlugin.INSTANCE.getPreferenceStore() .getString(IPreferenceConstants.PREFS_COMMIT_USER_NAME); String userEmail = ModelRepositoryPlugin.INSTANCE.getPreferenceStore() .getString(IPreferenceConstants.PREFS_COMMIT_USER_EMAIL); if (!StringUtils.isSet(userName) || !StringUtils.isSet(userEmail)) { boolean response = MessageDialog.openConfirm(fWindow.getShell(), "Commit", "User name and/or email not set. Set now?"); if (response) { // Open Preferences PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(fWindow.getShell(), ModelRepositoryPreferencePage.ID, null, null); if (dialog != null) { //ModelRepositoryPreferencePage page = (ModelRepositoryPreferencePage)dialog.getSelectedPage(); //page.selectSomeTab(); dialog.open(); return; } } else { return; } } PersonIdent personIdent = new PersonIdent(userName, userEmail); String commitMessage = "Test commit message from model repo!"; GraficoUtils.commitModel(model, getGitRepository(), personIdent, commitMessage); } catch (IOException | GitAPIException ex) { ex.printStackTrace(); } } } }
From source file:org.aw20.mongoworkbench.eclipse.MMenuManager.java
License:Open Source License
public void handleEvent(Event event) { if (event.type == SWT.Selection) { if (event.widget == prefItem) { PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(null, "org.aw20.mongoworkbench.eclipse.pref.MPrefPage", null, null); dialog.open(); }/* ww w . ja va 2s . c o m*/ } }
From source file:org.cfeclipse.cfml.frameworks.views.FrameworksView.java
License:Open Source License
private void makeActions() { csAddBeanAction = new Action() { public void run() { //showMessage("Executing Add Bean"); //CUT //try the JDOM in-situ TreeSelection sel = (TreeSelection) viewer.getSelection(); if (sel.getFirstElement() instanceof TreeParentNode) { TreeParentNode selNode = (TreeParentNode) sel.getFirstElement(); if (selNode.getType().equals(FrameworkManager.COLDSPRING)) { CSAddBeanDialog addDialog = new CSAddBeanDialog(viewer.getControl().getShell()); if (addDialog.open() == IDialogConstants.OK_ID) { String id = addDialog.getCfcName().getText(); String className = addDialog.getCfcExtends().getText(); System.out.println("Dialog says " + id + " " + className); Document document = selNode.getDocument(); Element child = document.getRootElement(); //Bean Element Element newBean = new Element("bean"); newBean.setAttribute("id", addDialog.getCfcName().getText()); newBean.setAttribute("class", addDialog.getCfcExtends().getText()); child.addContent(newBean); XMLOutputter outputter = new XMLOutputter(); try { outputter.output(child, System.out); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); }/*from www. j av a 2s . c o m*/ } } } //CUT } }; csAddBeanAction.setText("Add bean from CFC"); csAddBeanAction.setToolTipText("Adds a bean to coldspring from a CFC"); csAddBeanAction.setImageDescriptor( PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK)); action1 = new Action() { public void run() { showMessage("Action 1 executed"); } }; refreshAction = new Action() { public void run() { //showMessage("some refresh"); refreshFrameworkTree(); } }; refreshAction.setImageDescriptor(FWXImages.getImageRegistry().getDescriptor(FWXImages.ICON_REFRESH)); viewXMLAction = new Action() { public void run() { ViewXMLDialog vxd = new ViewXMLDialog(getSite().getShell(), ((FrameworksContentProvider) viewer.getContentProvider()).getVirtualDocument()); vxd.open(); // open dialog with just an XML thing } }; viewXMLAction.setImageDescriptor(FWXImages.getImageRegistry().getDescriptor(FWXImages.ICON_XML_VIEW)); action1.setText("Action 1"); action1.setToolTipText("Action 1 tooltip"); action1.setImageDescriptor( PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK)); action2 = new Action() { public void run() { TreeSelection sel = (TreeSelection) viewer.getSelection(); if (sel.getFirstElement() instanceof TreeParentNode) { TreeParentNode selNode = (TreeParentNode) sel.getFirstElement(); ActionsPreferencePage page = new ActionsPreferencePage(); page.setFilter(selNode); PreferenceManager mgr = new PreferenceManager(); IPreferenceNode node = new PreferenceNode("1", page); mgr.addToRoot(node); PreferenceDialog dialog = new PreferenceDialog(viewer.getControl().getShell(), mgr); dialog.create(); dialog.setMessage(page.getTitle()); dialog.open(); } } }; action2.setText("Configure..."); action2.setToolTipText("Configure the actions for this node"); doubleClickAction = new Action() { public void run() { ISelection selection = viewer.getSelection(); Object obj = ((IStructuredSelection) selection).getFirstElement(); showMessage("Double-click detected on " + obj.toString()); } }; }
From source file:org.cfeclipse.cfml.snippets.views.snips.SnipTreeView.java
License:Open Source License
/** * creates all the default actions//from w ww.j a v a 2 s .com */ protected void createActions() { openSnipExPage = new Action("Edit SnipEx Servers", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_SNIPEX)) { public void run() { IPreferencePage page = new SnipExPreferencePage(); PreferenceManager mgr = new PreferenceManager(); IPreferenceNode node = new PreferenceNode("1", page); mgr.addToRoot(node); PreferenceDialog dialog = new PreferenceDialog(getSite().getShell(), mgr); dialog.create(); dialog.setMessage(page.getTitle()); dialog.open(); } }; refreshSnipEx = new Action("Refresh SnipEx Server", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_REFRESH)) { public void run() { System.out.println("Refreshing the snipex server"); } }; insertAction = new Action("Insert", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_SNIP)) { public void run() { insertItem(); } }; insertAction.setToolTipText("Insert the selected snip into the document"); createFolderAction = new Action("Create Folder", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_PACKAGE)) { public void run() { createSnipFolder(); } }; createFolderAction.setToolTipText("Create a new snip package"); createSnippetAction = new Action("Create Snippet", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_ADD)) { public void run() { createSnippet(); } }; createSnippetAction.setToolTipText("Create a new snip"); editSnippetAction = new Action("Edit Snippet", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_EDIT)) { public void run() { editSnippet(); } }; editSnippetAction.setToolTipText("Edit the selected snip"); refreshSnippetsAction = new Action("Refresh Snippets", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_REFRESH)) { public void run() { reloadSnippets(true); } }; refreshSnippetsAction.setToolTipText("Refresh snip view"); deleteSnippetAction = new Action("Delete Snippet", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_REMOVE)) { public void run() { deleteSnippet(); } }; deleteSnippetAction.setToolTipText("Delete selected snip"); deleteFolderAction = new Action("Delete Folder", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_DELETE)) { public void run() { deleteSnipFolder(); } }; deleteFolderAction.setToolTipText("Delete selected snip package (must be empty)"); exportToSnipEx = new Action("Export to SnipEx server", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_SNIP_EXPORT)) { public void run() { IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection(); File selectedfile = (File) selection.getFirstElement(); Shell shell = getSite().getShell(); SnippetToSnipExWizard wizard = new SnippetToSnipExWizard(selectedfile); //TODO: pass in the object we have selected WizardDialog dialog = new WizardDialog(shell, wizard); dialog.open(); //Run the wizard } }; exportToSnipEx.setToolTipText("Export the selected snippet to a SnipX Server"); }
From source file:org.cfeclipse.cfml.views.snips.SnipTreeView.java
License:Open Source License
/** * creates all the default actions/* ww w .j a v a 2 s . co m*/ */ protected void createActions() { openSnipExPage = new Action("Edit SnipEx Servers", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_SNIPEX)) { public void run() { IPreferencePage page = new SnipExPreferencePage(); PreferenceManager mgr = new PreferenceManager(); IPreferenceNode node = new PreferenceNode("1", page); mgr.addToRoot(node); PreferenceDialog dialog = new PreferenceDialog(getSite().getShell(), mgr); dialog.create(); dialog.setMessage(page.getTitle()); dialog.open(); } }; refreshSnipEx = new Action("Refresh SnipEx Server", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_REFRESH)) { public void run() { System.out.println("Refreshing the snipex server"); } }; insertAction = new Action("Insert", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_SNIP)) { public void run() { insertItem(); } }; insertAction.setToolTipText("Insert the selected snip into the document"); createFolderAction = new Action("Create Folder", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_PACKAGE)) { public void run() { createSnipFolder(); } }; createFolderAction.setToolTipText("Create a new snip package"); createSnippetAction = new Action("Create Snippet", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_ADD)) { public void run() { createSnippet(); } }; createSnippetAction.setToolTipText("Create a new snip"); editSnippetAction = new Action("Edit Snippet", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_EDIT)) { public void run() { editSnippet(); } }; editSnippetAction.setToolTipText("Edit the selected snip"); refreshSnippetsAction = new Action("Refresh Snippets", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_REFRESH)) { public void run() { reloadSnippets(); } }; refreshSnippetsAction.setToolTipText("Refresh snip view"); deleteSnippetAction = new Action("Delete Snippet", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_REMOVE)) { public void run() { deleteSnippet(); } }; deleteSnippetAction.setToolTipText("Delete selected snip"); deleteFolderAction = new Action("Delete Folder", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_DELETE)) { public void run() { deleteSnipFolder(); } }; deleteFolderAction.setToolTipText("Delete selected snip package (must be empty)"); exportToSnipEx = new Action("Export to SnipEx server", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_SNIP_EXPORT)) { public void run() { IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection(); File selectedfile = (File) selection.getFirstElement(); Shell shell = getSite().getShell(); SnippetToSnipExWizard wizard = new SnippetToSnipExWizard(selectedfile); //TODO: pass in the object we have selected WizardDialog dialog = new WizardDialog(shell, wizard); int result = dialog.open(); //Run the wizard } }; exportToSnipEx.setToolTipText("Export the selected snippet to a SnipX Server"); }
From source file:org.chromium.debug.ui.actions.JsBreakpointPropertiesAction.java
License:Open Source License
protected static void runAction(IBreakpoint breakpoint, IShellProvider shell) { PreferenceDialog propertyDialog = PreferencesUtil.createPropertyDialogOn(shell.getShell(), breakpoint, (String) null, (String[]) null, null); propertyDialog.open(); }