-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'refs/remotes/angelozerr/master'
- Loading branch information
Showing
9 changed files
with
116 additions
and
40 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
...clipse.ide.ui/src/tern/eclipse/ide/internal/ui/preferences/TernServerPreferencesPage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/** | ||
* Copyright (c) 2013-2015 Angelo ZERR. | ||
* All rights reserved. This program and the accompanying materials | ||
* are 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: | ||
* Angelo Zerr <angelo.zerr@gmail.com> - initial API and implementation | ||
*/ | ||
package tern.eclipse.ide.internal.ui.preferences; | ||
|
||
import org.eclipse.core.runtime.preferences.IScopeContext; | ||
import org.eclipse.core.runtime.preferences.InstanceScope; | ||
import org.eclipse.jface.preference.ComboFieldEditor; | ||
import org.eclipse.jface.preference.FieldEditorPreferencePage; | ||
import org.eclipse.jface.preference.IPreferenceStore; | ||
import org.eclipse.jface.util.PropertyChangeEvent; | ||
import org.eclipse.ui.IWorkbench; | ||
import org.eclipse.ui.IWorkbenchPreferencePage; | ||
import org.eclipse.ui.preferences.ScopedPreferenceStore; | ||
|
||
import tern.eclipse.ide.core.ITernServerType; | ||
import tern.eclipse.ide.core.TernCorePlugin; | ||
import tern.eclipse.ide.core.preferences.TernCorePreferenceConstants; | ||
import tern.eclipse.ide.internal.ui.TernUIMessages; | ||
import tern.eclipse.ide.ui.ImageResource; | ||
|
||
/** | ||
* Tern Server preferences page. | ||
* | ||
*/ | ||
public class TernServerPreferencesPage extends FieldEditorPreferencePage | ||
implements IWorkbenchPreferencePage { | ||
|
||
public TernServerPreferencesPage() { | ||
super(GRID); | ||
setDescription(TernUIMessages.TernServerPreferencesPage_desc); | ||
setImageDescriptor(ImageResource | ||
.getImageDescriptor(ImageResource.IMG_LOGO)); | ||
} | ||
|
||
@Override | ||
protected void createFieldEditors() { | ||
|
||
// Tern Server type combo | ||
ITernServerType[] serverTypes = TernCorePlugin | ||
.getTernServerTypeManager().getTernServerTypes(); | ||
String[][] types = new String[serverTypes.length + 1][2]; | ||
types[0][0] = " -- Choose your server type --"; //$NON-NLS-1$ | ||
types[0][1] = ""; //$NON-NLS-1$ | ||
|
||
for (int i = 0; i < serverTypes.length; i++) { | ||
types[i + 1][0] = serverTypes[i].getName(); | ||
types[i + 1][1] = serverTypes[i].getId(); | ||
} | ||
|
||
ComboFieldEditor ternServerEditor = new ComboFieldEditor( | ||
TernCorePreferenceConstants.TERN_SERVER_TYPE, | ||
TernUIMessages.TernServerPreferencesPage_serverType, types, | ||
getFieldEditorParent()); | ||
addField(ternServerEditor); | ||
} | ||
|
||
@Override | ||
public void init(IWorkbench workbench) { | ||
|
||
} | ||
|
||
@Override | ||
protected IPreferenceStore doGetPreferenceStore() { | ||
// IProject project = getProject(); | ||
// ScopedPreferenceStore store; | ||
// if (project == null) { | ||
// // workspace settings | ||
// IScopeContext scope = new InstanceScope(); | ||
// return new ScopedPreferenceStore(scope, TernCorePlugin.PLUGIN_ID); | ||
// } else { | ||
// // project settings | ||
// IScopeContext projectScope = new ProjectScope(project); | ||
// preferences = projectScope.getNode(TernCorePlugin.PLUGIN_ID); | ||
// store = new ScopedPreferenceStore(projectScope, | ||
// TernCorePlugin.PLUGIN_ID); | ||
// } | ||
// return store; | ||
IScopeContext scope = new InstanceScope(); | ||
return new ScopedPreferenceStore(scope, TernCorePlugin.PLUGIN_ID); | ||
|
||
} | ||
|
||
@Override | ||
public void propertyChange(PropertyChangeEvent event) { | ||
super.propertyChange(event); | ||
TernCorePlugin.getTernServerTypeManager().refresh(); | ||
} | ||
|
||
} |