Author: adietish
Date: 2011-01-31 10:46:02 -0500 (Mon, 31 Jan 2011)
New Revision: 28769
Removed:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/PreferencesContentProposalProvider.java
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/DeltaCloudUIUtils.java
Log:
[JBIDE-8259] added content proposals for cloud name, cloud url, username
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/DeltaCloudUIUtils.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/DeltaCloudUIUtils.java 2011-01-31
15:23:36 UTC (rev 28768)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/DeltaCloudUIUtils.java 2011-01-31
15:46:02 UTC (rev 28769)
@@ -10,34 +10,38 @@
******************************************************************************/
package org.jboss.tools.internal.deltacloud.ui.utils;
+import org.eclipse.jface.bindings.keys.KeyStroke;
import org.eclipse.jface.fieldassist.ContentProposalAdapter;
+import org.eclipse.jface.fieldassist.SimpleContentProposalProvider;
import org.eclipse.jface.fieldassist.TextContentAdapter;
+import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.widgets.Text;
import org.jboss.tools.deltacloud.ui.Activator;
-import
org.jboss.tools.internal.deltacloud.ui.wizards.PreferencesContentProposalProvider;
+import org.jboss.tools.internal.deltacloud.ui.preferences.StringEntriesPreferenceValue;
/**
* @author André Dietisheim
*/
public class DeltaCloudUIUtils {
- private static char[] ACTIVATION_CHARS =
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ:.,-".toCharArray();
-
public static ContentProposalAdapter createPreferencesProposalAdapter(final Text text,
String preferencesKey) {
- final PreferencesContentProposalProvider proposalProvider = new
PreferencesContentProposalProvider(preferencesKey, Activator.PLUGIN_ID);
+ final StringEntriesPreferenceValue preferencesValues = new
StringEntriesPreferenceValue(",", preferencesKey, Activator.PLUGIN_ID);
+ SimpleContentProposalProvider proposalProvider = new
SimpleContentProposalProvider(preferencesValues.get());
proposalProvider.setFiltering(true);
text.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
String currentValue = text.getText();
- proposalProvider.add(currentValue);
- proposalProvider.save();
+ preferencesValues.add(currentValue);
+ preferencesValues.store();
}
});
- ContentProposalAdapter proposalAdapter = new ContentProposalAdapter(text, new
TextContentAdapter(), proposalProvider, null, ACTIVATION_CHARS);
+
+ KeyStroke keyStroke = KeyStroke.getInstance(SWT.CONTROL, ' ');
+ ContentProposalAdapter proposalAdapter = new ContentProposalAdapter(text, new
TextContentAdapter(), proposalProvider, keyStroke, null);
proposalAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
return proposalAdapter;
}
Deleted:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/PreferencesContentProposalProvider.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/PreferencesContentProposalProvider.java 2011-01-31
15:23:36 UTC (rev 28768)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/PreferencesContentProposalProvider.java 2011-01-31
15:46:02 UTC (rev 28769)
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.internal.deltacloud.ui.wizards;
-
-import org.eclipse.jface.fieldassist.SimpleContentProposalProvider;
-import org.jboss.tools.internal.deltacloud.ui.preferences.StringEntriesPreferenceValue;
-
-/**
- * @author André Dietisheim
- */
-public class PreferencesContentProposalProvider extends SimpleContentProposalProvider {
-
- private StringEntriesPreferenceValue preferencesValues;
-
- public PreferencesContentProposalProvider(String preferencesKey, String pluginId) {
- super(new String[] {});
- this.preferencesValues = new StringEntriesPreferenceValue(",",
preferencesKey, pluginId);
- setProposals(preferencesValues.get());
- }
-
- public void add(String newEntry) {
- preferencesValues.add(newEntry);
- }
-
- public void save() {
- preferencesValues.store();
- }
-}