use of org.eclipse.jface.preference.PreferenceNode in project janrufmonitor by tbrandt77.
the class ConfigurationCommand method createPreferenceNodes.
private void createPreferenceNodes(PreferenceManager mgr) {
this.buildPageList();
List rootNodes = this.getRootPages();
IConfigPage page = null;
for (int i = 0; i < rootNodes.size(); i++) {
page = (IConfigPage) rootNodes.get(i);
if (page != null && page instanceof IPreferencePage) {
IPreferenceNode n = new PreferenceNode(page.getNodeID(), this.m_i18n.getString(page.getNamespace(), "title", "label", this.m_language), null, page.getClass().getName());
mgr.addToRoot(n);
}
}
for (int i = 0; i < this.m_pages.size(); i++) {
page = (IConfigPage) this.m_pages.get(i);
if (page != null && page instanceof IPreferencePage) {
IPreferenceNode parent = mgr.find(page.getParentNodeID());
if (parent != null) {
IPreferenceNode n = new PreferenceNode(page.getNodeID(), this.m_i18n.getString(page.getNamespace(), "title", "label", this.m_language), null, page.getClass().getName());
parent.add(n);
}
}
}
}
use of org.eclipse.jface.preference.PreferenceNode in project abstools by abstools.
the class apetHandler method execute.
/**
* the command has been executed, so extract the needed information
* from the application context.
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
final Shell shellEclipse = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
ApetShellCommand shell = new ApetShellCommand();
try {
ConsoleHandler.defaultConsole = ConsoleHandler.findCostabsConsole();
String absFile = SourceUtils.extractResource(SourceUtils.obtainActiveEditor()).getLocation().toString();
// Creating the costabs tmp directory
File f = new File("//tmp//costabs//absPL");
f.mkdirs();
if (CostabsLink.ENTRIES_STRINGS.size() <= 0) {
Status status = new Status(IStatus.ERROR, "costabs", 0, "At least one function or method must be selected in the outline view.", null);
ErrorDialog.openError(shellEclipse, "aPET Error", "aPET cannot be run.", status);
} else {
/*OptionsDialog mDialog = new OptionsDialog (shellEclipse);
mDialog.open();
if (mDialog.getReturnCode() == OptionsDialog.CANCEL) {
ConsoleHandler.write("Don't do anything, cancelled by the user");*/
IPreferencePage page = new ApetPreferences();
PreferenceManager mgr = new PreferenceManager();
IPreferenceNode node = new PreferenceNode("1", page);
mgr.addToRoot(node);
PreferenceDialog dialog = new PreferenceDialog(shellEclipse, mgr);
dialog.create();
dialog.setMessage("aPET preferences");
dialog.open();
if (dialog.getReturnCode() == PreferenceDialog.CANCEL) {
return null;
} else {
callPrologBackend(absFile);
shell.callAPet(CostabsLink.ENTRIES_STRINGS);
printError(shell);
ApetTestSuite suite = callXMLParser();
if (translate) {
Model m = getABSModel(absFile);
generateABSUnitTests(m, suite, new File(new File(absFile).getParentFile(), absUnitOutputFile));
}
}
ConsoleHandler.write(shell.getResult());
}
} catch (Exception e) {
ConsoleHandler.write(shell.getError());
e.printStackTrace(new PrintStream(ConsoleHandler.getDefault().newMessageStream()));
}
return null;
}
use of org.eclipse.jface.preference.PreferenceNode in project vsDiaryWriter by shilongdai.
the class JournalApplication method initModules.
/**
* load all providers.
*
* This method loads all provider available.
*/
public static void initModules() {
// prepare to load modules
modules = new File("modules");
CommonFunctions.initDir(modules);
m = new PF4JModuleLoader();
// put system configuration first
ConfigurationGUISetup setup = new ConfigurationGUISetup() {
@Override
public void proccess(PreferenceManager mger) {
PreferenceNode system = new PreferenceNode("system", "System", null, SystemPreferencePage.class.getCanonicalName());
mger.addToRoot(system);
}
};
PreferenceGUIManager.add(setup);
// register the providers
AuthManagers.INSTANCE.registerAuthProvider(new ViperfishAuthProvider());
EntryDatabases.INSTANCE.registerEntryDatabaseProvider(new ViperfishEntryDatabaseProvider());
Indexers.INSTANCE.registerIndexerProvider(new ViperfishIndexerProvider());
JournalTransformers.INSTANCE.registerTransformerProvider(new ViperfishEncryptionProvider());
// load third party
m.loadModules(modules);
}
use of org.eclipse.jface.preference.PreferenceNode in project azure-tools-for-java by Microsoft.
the class PluginUtil method openPropertyPageDialog.
/**
* Method opens property dialog with only desired property page.
*
* @param nodeId
* : Node ID of property page
* @param nodeLbl
* : Property page name
* @param classObj
* : Class object of property page
* @return
*/
public static int openPropertyPageDialog(String nodeId, String nodeLbl, Object classObj) {
// value corresponding to cancel
int retVal = Window.CANCEL;
// Node creation
try {
PreferenceNode nodePropPg = new PreferenceNode(nodeId, nodeLbl, null, classObj.getClass().toString());
nodePropPg.setPage((IPreferencePage) classObj);
nodePropPg.getPage().setTitle(nodeLbl);
PreferenceManager mgr = new PreferenceManager();
mgr.addToRoot(nodePropPg);
// Dialog creation
PreferenceDialog dialog = new PreferenceDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), mgr);
// make desired property page active.
dialog.setSelectedNode(nodeLbl);
dialog.create();
/*
* If showing storage accounts preference page, don't show
* properties for title as its common repository.
*/
String dlgTitle = "";
if (nodeLbl.equals(Messages.cmhLblStrgAcc) || nodeLbl.equals(Messages.aiTxt)) {
dlgTitle = nodeLbl;
} else {
dlgTitle = String.format(Messages.cmhPropFor, getSelectedProject().getName());
}
dialog.getShell().setText(dlgTitle);
dialog.open();
// return whether user has pressed OK or Cancel button
retVal = dialog.getReturnCode();
} catch (Exception e) {
PluginUtil.displayErrorDialogAndLog(PluginUtil.getParentShell(), Messages.rolsDlgErr, Messages.projDlgErrMsg, e);
}
return retVal;
}
Aggregations