Search in sources :

Example 11 with PreferenceNode

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);
            }
        }
    }
}
Also used : IPreferenceNode(org.eclipse.jface.preference.IPreferenceNode) PreferenceNode(org.eclipse.jface.preference.PreferenceNode) IPreferencePage(org.eclipse.jface.preference.IPreferencePage) ArrayList(java.util.ArrayList) List(java.util.List) IPreferenceNode(org.eclipse.jface.preference.IPreferenceNode)

Example 12 with PreferenceNode

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;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) PrintStream(java.io.PrintStream) PreferenceNode(org.eclipse.jface.preference.PreferenceNode) IPreferenceNode(org.eclipse.jface.preference.IPreferenceNode) ApetShellCommand(apet.console.ApetShellCommand) ApetPreferences(apet.preferences.ApetPreferences) IPreferenceNode(org.eclipse.jface.preference.IPreferenceNode) PreferenceManager(org.eclipse.jface.preference.PreferenceManager) IOException(java.io.IOException) ExecutionException(org.eclipse.core.commands.ExecutionException) Shell(org.eclipse.swt.widgets.Shell) PreferenceDialog(org.eclipse.jface.preference.PreferenceDialog) Model(abs.frontend.ast.Model) IPreferencePage(org.eclipse.jface.preference.IPreferencePage) ApetTestSuite(apet.testCases.ApetTestSuite) File(java.io.File)

Example 13 with PreferenceNode

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);
}
Also used : ConfigurationGUISetup(net.viperfish.journal.framework.provider.ConfigurationGUISetup) ViperfishEntryDatabaseProvider(net.viperfish.journal.dbProvider.ViperfishEntryDatabaseProvider) PreferenceNode(org.eclipse.jface.preference.PreferenceNode) ViperfishIndexerProvider(net.viperfish.journal.indexProvider.ViperfishIndexerProvider) ViperfishEncryptionProvider(net.viperfish.journal.secureProvider.ViperfishEncryptionProvider) ViperfishAuthProvider(net.viperfish.journal.authProvider.ViperfishAuthProvider) File(java.io.File) PreferenceManager(org.eclipse.jface.preference.PreferenceManager)

Example 14 with PreferenceNode

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;
}
Also used : PreferenceDialog(org.eclipse.jface.preference.PreferenceDialog) PreferenceNode(org.eclipse.jface.preference.PreferenceNode) PreferenceManager(org.eclipse.jface.preference.PreferenceManager) CoreException(org.eclipse.core.runtime.CoreException) IOException(java.io.IOException)

Aggregations

PreferenceNode (org.eclipse.jface.preference.PreferenceNode)14 PreferenceManager (org.eclipse.jface.preference.PreferenceManager)11 PreferenceDialog (org.eclipse.jface.preference.PreferenceDialog)6 IPreferenceNode (org.eclipse.jface.preference.IPreferenceNode)5 QueryOptionPreferencePage (com.cubrid.common.ui.query.preference.QueryOptionPreferencePage)2 CMPreferenceDialog (com.cubrid.common.ui.spi.dialog.CMPreferenceDialog)2 CubridServer (com.cubrid.common.ui.spi.model.CubridServer)2 File (java.io.File)2 IOException (java.io.IOException)2 ConfigurationGUISetup (net.viperfish.journal.framework.provider.ConfigurationGUISetup)2 CoreException (org.eclipse.core.runtime.CoreException)2 Execute (org.eclipse.e4.core.di.annotations.Execute)2 IPreferencePage (org.eclipse.jface.preference.IPreferencePage)2 Model (abs.frontend.ast.Model)1 ApetShellCommand (apet.console.ApetShellCommand)1 ApetPreferences (apet.preferences.ApetPreferences)1 ApetTestSuite (apet.testCases.ApetTestSuite)1 NullCategoryPreferencePage (com.cubrid.common.ui.common.preference.NullCategoryPreferencePage)1 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)1 ServerType (com.cubrid.cubridmanager.core.common.model.ServerType)1