Search in sources :

Example 21 with IPreferenceStore

use of org.eclipse.jface.preference.IPreferenceStore in project tdi-studio-se by Talend.

the class PreferenceInitializer method initializeDefaultPreferences.

public void initializeDefaultPreferences() {
    IPreferenceStore store = SqlBuilderPlugin.getDefault().getPreferenceStore();
    // for PassPolicy Preference
    //$NON-NLS-1$
    store.setDefault(IConstants.CLIP_EXPORT_SEPARATOR, "|");
    //$NON-NLS-1$
    store.setDefault(IConstants.DATASETRESULT_DATE_FORMAT, "yyyy-MM-dd");
    store.setDefault(IConstants.DATASETRESULT_FORMAT_DATES, true);
    store.setDefault(IConstants.SQL_ASSIST, false);
    //$NON-NLS-1$
    store.setDefault(IConstants.LINE_DELIMITER, "\n");
    //$NON-NLS-1$
    store.setDefault(IConstants.COMMENT_DELIMITER, "#");
    //$NON-NLS-1$
    store.setDefault(IConstants.ALTERNATE_DELIMITER, "");
    //$NON-NLS-1$
    store.setDefault(IConstants.QUERY_DELIMITER, ";");
    store.setDefault(IConstants.WARN_RESEULTS, 5000);
}
Also used : IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Example 22 with IPreferenceStore

use of org.eclipse.jface.preference.IPreferenceStore in project tesb-studio-se by Talend.

the class StartRuntimeProgress method run.

@Override
public void run(IProgressMonitor parentMonitor) throws InvocationTargetException, InterruptedException {
    SubMonitor subMonitor = SubMonitor.convert(parentMonitor, 10);
    //$NON-NLS-1$
    subMonitor.setTaskName(RunContainerMessages.getString("StartRuntimeAction.Starting"));
    if (!checkRunning()) {
        try {
            IPreferenceStore store = ESBRunContainerPlugin.getDefault().getPreferenceStore();
            Process proc = RuntimeServerController.getInstance().startLocalRuntimeServer(store.getString(RunContainerPreferenceInitializer.P_ESB_RUNTIME_LOCATION));
            int i = 0;
            //$NON-NLS-1$
            String dot = ".";
            while (JMXUtil.createJMXconnection() == null && ++i < 11 && !subMonitor.isCanceled() && proc.isAlive()) {
                //$NON-NLS-1$
                subMonitor.subTask(RunContainerMessages.getString("StartRuntimeAction.Try") + dot);
                //$NON-NLS-1$
                dot += ".";
                subMonitor.worked(1);
                Thread.sleep(3000);
            }
            if (!proc.isAlive()) {
                RuntimeServerController.getInstance().stopLocalRuntimeServer();
                throw new InterruptedException(RunContainerMessages.getString("RunContainerPreferencePage.InitailzeDialog8", proc.exitValue()));
            }
            if (JMXUtil.createJMXconnection() == null) {
                throw new InterruptedException(RunContainerMessages.getString("RunContainerPreferencePage.InitailzeDialog5"));
            }
        } catch (Exception e) {
            ExceptionHandler.process(e);
            throw new InvocationTargetException(e, e.getMessage());
        }
    }
    loadConsole();
}
Also used : SubMonitor(org.eclipse.core.runtime.SubMonitor) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) InvocationTargetException(java.lang.reflect.InvocationTargetException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 23 with IPreferenceStore

use of org.eclipse.jface.preference.IPreferenceStore in project tesb-studio-se by Talend.

the class RuntimeClientProgress method run.

@Override
public void run(IProgressMonitor parentMonitor) throws InvocationTargetException, InterruptedException {
    System.out.println("Running command " + command);
    SubMonitor subMonitor = SubMonitor.convert(parentMonitor, 10);
    //$NON-NLS-1$
    subMonitor.setTaskName("Running script (" + command + ")");
    if (checkRunning()) {
        subMonitor.subTask("Checking runtime bundles...");
        waitForActive(subMonitor);
        subMonitor.worked(2);
        IPreferenceStore store = ESBRunContainerPlugin.getDefault().getPreferenceStore();
        File containerDir = new File(store.getString(RunContainerPreferenceInitializer.P_ESB_RUNTIME_LOCATION));
        try {
            subMonitor.subTask("Script is running to end...");
            executeScript(containerDir);
            subMonitor.worked(8);
            int size = log.size();
            if (!log.get(size - 1).equals("EOF")) {
                System.out.println("initlocal.sh logs: " + getLog());
                StackTraceElement[] stackTrace = new StackTraceElement[size];
                for (int i = 0; i < size; i++) {
                    stackTrace[i] = new StackTraceElement("RuntimeClientProgress", log.get(i), "Unknown source", i);
                }
                InterruptedException e = new InterruptedException("Script initlocal.sh run failed");
                e.setStackTrace(stackTrace);
                throw e;
            }
        } catch (IOException e) {
            throw new InvocationTargetException(e);
        }
    }
}
Also used : SubMonitor(org.eclipse.core.runtime.SubMonitor) IOException(java.io.IOException) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) File(java.io.File) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 24 with IPreferenceStore

use of org.eclipse.jface.preference.IPreferenceStore in project tdi-studio-se by Talend.

the class SpagicPreferenceInitializer method initializeDefaultPreferences.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
     */
@Override
public void initializeDefaultPreferences() {
    IPreferenceStore store = Activator.getDefault().getPreferenceStore();
    store.setDefault(SPAGIC_STATUS, false);
}
Also used : IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Example 25 with IPreferenceStore

use of org.eclipse.jface.preference.IPreferenceStore in project tdi-studio-se by Talend.

the class SpagicPreferencePage method createFieldEditors.

/*
     * @Override protected IPreferenceStore doGetPreferenceStore() { // SpagoPreferenceStore preferenceStore = new
     * SpagoPreferenceStore(ProxyRepositoryFactory.getInstance()); // try { // preferenceStore.load(); // } catch
     * (PersistenceException e) { // String detailError = e.getMessage(); // new ErrorDialogWidthDetailArea(new Shell(),
     * RepositoryPlugin.PLUGIN_ID, Messages // .getString("CommonWizard.persistenceException"), detailError);
     * //$NON-NLS-1$ // log.error(Messages.getString("CommonWizard.persistenceException") + "\n" + detailError);
     * //$NON-NLS-1$ // //$NON-NLS-2$ // } // return preferenceStore; return
     * Activator.getDefault().getPreferenceStore(); }
     */
@Override
protected void createFieldEditors() {
    parent = getFieldEditorParent();
    spagicCheckButton = new CheckBoxFieldEditor(SpagicPreferenceInitializer.SPAGIC_STATUS, "Enable/Disable Deploy on Spagic", //$NON-NLS-1$
    parent);
    //$NON-NLS-1$
    editor = new SpagicServerEditor(SpagoBiServer.SPAGOBI_SERVER, "Spagic server", parent);
    addField(editor);
    updateEnableStateFromPreferences();
    SelectionListener listener = new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            IPreferenceStore preferenceStore = getPreferenceStore();
            preferenceStore.setValue(SpagicPreferenceInitializer.SPAGIC_STATUS, ((Button) e.getSource()).getSelection());
            updateEnableStateFromDisplay();
        }
    };
    spagicCheckButton.getButton().addSelectionListener(listener);
// disable the spagic feature
// spagicCheckButton.setEnabled(false, parent);
}
Also used : SelectionEvent(org.eclipse.swt.events.SelectionEvent) CheckBoxFieldEditor(org.talend.commons.ui.swt.preferences.CheckBoxFieldEditor) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) SelectionListener(org.eclipse.swt.events.SelectionListener)

Aggregations

IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)673 ArrayList (java.util.ArrayList)52 Test (org.junit.Test)36 File (java.io.File)32 RGB (org.eclipse.swt.graphics.RGB)26 GridData (org.eclipse.swt.layout.GridData)26 IOException (java.io.IOException)23 CoreException (org.eclipse.core.runtime.CoreException)23 GridLayout (org.eclipse.swt.layout.GridLayout)23 Composite (org.eclipse.swt.widgets.Composite)23 List (java.util.List)21 SelectionEvent (org.eclipse.swt.events.SelectionEvent)21 Before (org.junit.Before)21 FontData (org.eclipse.swt.graphics.FontData)20 Hashtable (java.util.Hashtable)19 Button (org.eclipse.swt.widgets.Button)18 StyledText (org.eclipse.swt.custom.StyledText)17 Font (org.eclipse.swt.graphics.Font)17 ChainedPreferenceStore (org.eclipse.ui.texteditor.ChainedPreferenceStore)17 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)16