Skip to content

Commit

Permalink
rename ForgeRuntimesPreferences into ForgeCorePreferences
Browse files Browse the repository at this point in the history
  • Loading branch information
koentsje committed Feb 20, 2014
1 parent e2994bf commit 3c0b19e
Show file tree
Hide file tree
Showing 17 changed files with 63 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.jboss.tools.forge.core.internal.ForgeCorePlugin;
import org.jboss.tools.forge.core.preferences.ForgeRuntimesPreferences;
import org.jboss.tools.forge.core.preferences.ForgeCorePreferences;

public class ForgeCorePreferencesInitializer extends AbstractPreferenceInitializer {

Expand All @@ -17,7 +17,7 @@ public class ForgeCorePreferencesInitializer extends AbstractPreferenceInitializ
@Override
public void initializeDefaultPreferences() {
IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(ForgeCorePlugin.PLUGIN_ID);
preferences.put(ForgeRuntimesPreferences.PREF_FORGE_RUNTIMES, INITIAL_RUNTIMES_PREFERENCE);
preferences.put(ForgeCorePreferences.PREF_FORGE_RUNTIMES, INITIAL_RUNTIMES_PREFERENCE);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import org.eclipse.debug.core.model.IProcess;
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
import org.jboss.tools.forge.core.internal.ForgeCorePlugin;
import org.jboss.tools.forge.core.preferences.ForgeRuntimesPreferences;
import org.jboss.tools.forge.core.preferences.ForgeCorePreferences;


public class ForgeLaunchHelper {
Expand Down Expand Up @@ -77,7 +77,7 @@ private static ILaunch doLaunch(String launchConfigurationName, String location)
}

private static String getLaunchMode() {
return ForgeRuntimesPreferences.INSTANCE.getStartInDebug() ?
return ForgeCorePreferences.INSTANCE.getStartInDebug() ?
ILaunchManager.DEBUG_MODE : ILaunchManager.RUN_MODE;
}

Expand Down Expand Up @@ -139,7 +139,7 @@ private static String getExtraModulesLocation() {
}

private static String getVmArgumentPrefs() {
String str = ForgeRuntimesPreferences.INSTANCE.getVmArgs();
String str = ForgeCorePreferences.INSTANCE.getVmArgs();
if (!"".equals(str)) {
str += " ";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;

public class ForgeRuntimesPreferences {
public class ForgeCorePreferences {

public static final String PREF_FORGE_RUNTIMES = "org.jboss.tools.forge.core.runtimes";
public static final String PREF_FORGE_STARTUP = "org.jboss.tools.forge.core.startup";
public static final String PREF_FORGE_START_IN_DEBUG = "org.jboss.tools.forge.core.startInDebug";
public static final String PREF_FORGE_VM_ARGS = "org.jboss.tools.forge.core.vmArgs";

public static final ForgeRuntimesPreferences INSTANCE = new ForgeRuntimesPreferences();
public static final ForgeCorePreferences INSTANCE = new ForgeCorePreferences();

private List<ForgeRuntime> runtimes = null;
private ForgeRuntime defaultRuntime = null;

private ForgeRuntimesPreferences() {}
private ForgeCorePreferences() {}

public ForgeRuntime[] getRuntimes() {
if (runtimes == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.eclipse.core.resources.IProject;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.jboss.tools.forge.core.preferences.ForgeRuntimesPreferences;
import org.jboss.tools.forge.core.preferences.ForgeCorePreferences;
import org.jboss.tools.forge.core.runtime.ForgeRuntime;
import org.jboss.tools.forge.ui.wizards.WizardsPlugin;

Expand All @@ -25,7 +25,7 @@ public static boolean isHibernateToolsPluginAvailable() {
Runnable command = new Runnable() {
@Override
public void run() {
ForgeRuntime runtime = ForgeRuntimesPreferences.INSTANCE.getDefaultRuntime();
ForgeRuntime runtime = ForgeCorePreferences.INSTANCE.getDefaultRuntime();
String str = runtime.sendCommand("forge list-plugins");
synchronized(buff) {
buff.append(str).append(" done");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import org.eclipse.ui.ISelectionService;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PlatformUI;
import org.jboss.tools.forge.core.preferences.ForgeRuntimesPreferences;
import org.jboss.tools.forge.core.preferences.ForgeCorePreferences;
import org.jboss.tools.forge.core.runtime.ForgeRuntime;
import org.jboss.tools.forge.ui.ForgeUIPlugin;
import org.jboss.tools.forge.ui.util.ForgeHelper;
Expand Down Expand Up @@ -81,7 +81,7 @@ private void goToPath(String str) {
if (str.indexOf(' ') != -1) {
str = '\"' + str + '\"';
}
ForgeRuntime runtime = ForgeRuntimesPreferences.INSTANCE.getDefaultRuntime();
ForgeRuntime runtime = ForgeCorePreferences.INSTANCE.getDefaultRuntime();
runtime.sendInput("pick-up " + str + "\n");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.navigator.CommonNavigator;
import org.jboss.tools.forge.core.preferences.ForgeRuntimesPreferences;
import org.jboss.tools.forge.core.preferences.ForgeCorePreferences;
import org.jboss.tools.forge.core.runtime.ForgeRuntime;
import org.jboss.tools.forge.ui.ForgeUIPlugin;
import org.jboss.tools.forge.ui.console.ForgeConsole;
Expand Down Expand Up @@ -98,7 +98,7 @@ private void showForgeConsole() {
if (workbenchPage != null) {
IViewPart forgeView = workbenchPage.findView(ForgeConsoleView.ID);
if (forgeView != null) {
ForgeRuntime runtime = ForgeRuntimesPreferences.INSTANCE.getDefaultRuntime();
ForgeRuntime runtime = ForgeCorePreferences.INSTANCE.getDefaultRuntime();
for (ForgeConsole forgeConsole : ForgeConsoleManager.INSTANCE.getConsoles()) {
if (runtime == forgeConsole.getRuntime()) {
((ForgeConsoleView)forgeView).showForgeConsole(forgeConsole);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.jboss.tools.forge.core.preferences.ForgeRuntimesPreferences;
import org.jboss.tools.forge.core.preferences.ForgeCorePreferences;
import org.jboss.tools.forge.core.runtime.ForgeRuntime;
import org.jboss.tools.forge.importer.ProjectImporter;

Expand Down Expand Up @@ -71,7 +71,7 @@ private void delete(File f) {
}

private void resetRuntime() {
ForgeRuntime runtime = ForgeRuntimesPreferences.INSTANCE.getDefaultRuntime();
ForgeRuntime runtime = ForgeCorePreferences.INSTANCE.getDefaultRuntime();
if (runtime != null && ForgeRuntime.STATE_RUNNING.equals(runtime.getState())) {
runtime.sendInput("reset\n");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.jboss.tools.forge.core.preferences.ForgeRuntimesPreferences;
import org.jboss.tools.forge.core.preferences.ForgeCorePreferences;
import org.jboss.tools.forge.core.runtime.ForgeRuntime;
import org.jboss.tools.forge.ui.actions.f1.GoToAction;
import org.jboss.tools.forge.ui.actions.f1.LinkAction;
Expand All @@ -20,7 +20,7 @@
public class ForgeConsoleImpl implements ForgeConsole, PropertyChangeListener {

private ForgeTextViewer forgeTextViewer = null;
private ForgeRuntime forgeRuntime = ForgeRuntimesPreferences.INSTANCE.getDefaultRuntime();
private ForgeRuntime forgeRuntime = ForgeCorePreferences.INSTANCE.getDefaultRuntime();
private String label = null;

public ForgeConsoleImpl() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.handlers.HandlerUtil;
import org.jboss.tools.forge.core.preferences.ForgeRuntimesPreferences;
import org.jboss.tools.forge.core.preferences.ForgeCorePreferences;
import org.jboss.tools.forge.core.runtime.ForgeRuntime;
import org.jboss.tools.forge.ui.ForgeUIPlugin;
import org.jboss.tools.forge.ui.console.ForgeConsole;
Expand Down Expand Up @@ -58,7 +58,7 @@ public Object execute(ExecutionEvent executionEvent) {
return null;
}
showForgeView(window);
runtime = ForgeRuntimesPreferences.INSTANCE.getDefaultRuntime();
runtime = ForgeCorePreferences.INSTANCE.getDefaultRuntime();
if (ForgeHelper.isForgeStarting()) {
showWaitUntilStartedMessage();
} else if (!ForgeHelper.isForgeRunning()) {
Expand Down Expand Up @@ -95,7 +95,7 @@ public void run() {
private void showForgeView(IWorkbenchWindow window) {
try {
IViewPart viewPart = window.getActivePage().showView(ForgeConsoleView.ID);
ForgeRuntime runtime = ForgeRuntimesPreferences.INSTANCE.getDefaultRuntime();
ForgeRuntime runtime = ForgeCorePreferences.INSTANCE.getDefaultRuntime();
for (ForgeConsole forgeConsole : ForgeConsoleManager.INSTANCE.getConsoles()) {
if (runtime == forgeConsole.getRuntime()) {
((ForgeConsoleView)viewPart).showForgeConsole(forgeConsole);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import org.eclipse.swt.custom.VerifyKeyListener;
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.widgets.Composite;
import org.jboss.tools.forge.core.preferences.ForgeRuntimesPreferences;
import org.jboss.tools.forge.core.preferences.ForgeCorePreferences;
import org.jboss.tools.forge.core.runtime.ForgeRuntime;
import org.jboss.tools.forge.ui.document.ForgeDocument;

Expand Down Expand Up @@ -154,7 +154,7 @@ protected void handleVerifyEvent(VerifyEvent e) {
}

private ForgeRuntime getRuntime() {
return ForgeRuntimesPreferences.INSTANCE.getDefaultRuntime();
return ForgeCorePreferences.INSTANCE.getDefaultRuntime();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.jboss.tools.forge.core.preferences.ForgeRuntimesPreferences;
import org.jboss.tools.forge.core.preferences.ForgeCorePreferences;
import org.jboss.tools.forge.core.runtime.ForgeRuntime;


Expand Down Expand Up @@ -42,7 +42,7 @@ public void partBroughtToTop(IWorkbenchPart part) {
if (path.indexOf(' ') != -1) {
path = '\"' + path + '\"';
}
ForgeRuntime forgeRuntime = ForgeRuntimesPreferences.INSTANCE.getDefaultRuntime();
ForgeRuntime forgeRuntime = ForgeCorePreferences.INSTANCE.getDefaultRuntime();
if (forgeRuntime != null && ForgeRuntime.STATE_RUNNING.equals(forgeRuntime.getState())) {
forgeRuntime.sendInput("pick-up " + path + "\n");
}
Expand Down Expand Up @@ -75,7 +75,7 @@ public void selectionChanged(IWorkbenchPart part, ISelection selection) {
if (path.indexOf(' ') != -1) {
path = '\"' + path + '\"';
}
ForgeRuntime forgeRuntime = ForgeRuntimesPreferences.INSTANCE.getDefaultRuntime();
ForgeRuntime forgeRuntime = ForgeCorePreferences.INSTANCE.getDefaultRuntime();
if (forgeRuntime != null && ForgeRuntime.STATE_RUNNING.equals(forgeRuntime.getState())) {
forgeRuntime.sendInput("pick-up " + path + "\n");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.jboss.tools.forge.core.preferences.ForgeRuntimesPreferences;
import org.jboss.tools.forge.core.preferences.ForgeCorePreferences;
import org.jboss.tools.forge.core.runtime.ForgeRuntime;
import org.jboss.tools.forge.core.runtime.ForgeRuntimeFactory;
import org.jboss.tools.forge.core.runtime.ForgeRuntimeType;
Expand Down Expand Up @@ -262,14 +262,14 @@ private void createVerticalSpacer(Composite parent) {

private void initializeForgeInstallations() {
runtimes = new ArrayList<ForgeRuntime>();
for (ForgeRuntime runtime : ForgeRuntimesPreferences.INSTANCE.getRuntimes()) {
for (ForgeRuntime runtime : ForgeCorePreferences.INSTANCE.getRuntimes()) {
ForgeRuntime copy = null;
if (ForgeRuntimeType.EMBEDDED.equals(runtime.getType())) {
copy = runtime;
} else if (ForgeRuntimeType.EXTERNAL.equals(runtime.getType())) {
copy = ForgeRuntimeFactory.INSTANCE.createForgeRuntime(runtime.getName(), runtime.getLocation());
}
if (runtime == ForgeRuntimesPreferences.INSTANCE.getDefaultRuntime()) {
if (runtime == ForgeCorePreferences.INSTANCE.getDefaultRuntime()) {
defaultRuntime = copy;
}
runtimes.add(copy);
Expand Down Expand Up @@ -307,7 +307,7 @@ public boolean performOk() {
public void run() {
ForgeRuntime[] runtimes = (ForgeRuntime[])runtimesTableViewer.getInput();
ForgeRuntime defaultRuntime = (ForgeRuntime)runtimesTableViewer.getCheckedElements()[0];
ForgeRuntimesPreferences.INSTANCE.setRuntimes(runtimes, defaultRuntime);
ForgeCorePreferences.INSTANCE.setRuntimes(runtimes, defaultRuntime);
refreshNeeded = false;
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.jboss.tools.forge.core.preferences.ForgeRuntimesPreferences;
import org.jboss.tools.forge.core.preferences.ForgeCorePreferences;

public class ForgeStartupPreferencePage extends PreferencePage implements
IWorkbenchPreferencePage {
Expand All @@ -35,7 +35,7 @@ private void createStartupButton(Composite parent) {
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 2;
startupButton.setLayoutData(gridData);
startupButton.setSelection(ForgeRuntimesPreferences.INSTANCE.getStartup());
startupButton.setSelection(ForgeCorePreferences.INSTANCE.getStartup());
}

private void createStartInDebugButton(Composite parent) {
Expand All @@ -44,15 +44,15 @@ private void createStartInDebugButton(Composite parent) {
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 2;
startInDebugButton.setLayoutData(gridData);
startInDebugButton.setSelection(ForgeRuntimesPreferences.INSTANCE.getStartInDebug());
startInDebugButton.setSelection(ForgeCorePreferences.INSTANCE.getStartInDebug());
}

private void createVmArgsText(Composite parent) {
Label vmArgsLabel = new Label(parent, SWT.NONE);
vmArgsLabel.setText("Forge Startup VM Arguments: ");
vmArgsText = new Text(parent, SWT.BORDER);
vmArgsText.setLayoutData(new GridData(GridData.FILL_BOTH));
String vmArgs = ForgeRuntimesPreferences.INSTANCE.getVmArgs();
String vmArgs = ForgeCorePreferences.INSTANCE.getVmArgs();
vmArgsText.setText(vmArgs == null ? "" : vmArgs);
}

Expand All @@ -74,9 +74,9 @@ private String getVmArgsText() {
}

public boolean performOk() {
ForgeRuntimesPreferences.INSTANCE.setStartup(startupButton.getSelection());
ForgeRuntimesPreferences.INSTANCE.setStartInDebug(startInDebugButton.getSelection());
ForgeRuntimesPreferences.INSTANCE.setVmArgs(getVmArgsText());
ForgeCorePreferences.INSTANCE.setStartup(startupButton.getSelection());
ForgeCorePreferences.INSTANCE.setStartInDebug(startInDebugButton.getSelection());
ForgeCorePreferences.INSTANCE.setVmArgs(getVmArgsText());
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IStartup;
import org.jboss.tools.forge.core.preferences.ForgeRuntimesPreferences;
import org.jboss.tools.forge.core.preferences.ForgeCorePreferences;
import org.jboss.tools.forge.ui.util.ForgeHelper;

public class ForgeStarter implements IStartup {

@Override
public void earlyStartup() {
if (ForgeRuntimesPreferences.INSTANCE.getStartup()) {
if (ForgeCorePreferences.INSTANCE.getStartup()) {
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Display;
import org.jboss.tools.forge.core.preferences.ForgeRuntimesPreferences;
import org.jboss.tools.forge.core.preferences.ForgeCorePreferences;
import org.jboss.tools.forge.core.runtime.ForgeRuntime;
import org.jboss.tools.forge.ui.document.ForgeDocument;

public class ForgeHelper {

public static void startForge() {
final ForgeRuntime runtime = ForgeRuntimesPreferences.INSTANCE.getDefaultRuntime();
final ForgeRuntime runtime = ForgeCorePreferences.INSTANCE.getDefaultRuntime();
if (runtime == null || ForgeRuntime.STATE_RUNNING.equals(runtime.getState())) return;
ForgeDocument.INSTANCE.connect(runtime);
Job job = new Job("Starting Forge " + runtime.getVersion()) {
Expand All @@ -38,7 +38,7 @@ public void run() {
}

public static void stopForge() {
final ForgeRuntime runtime = ForgeRuntimesPreferences.INSTANCE.getDefaultRuntime();
final ForgeRuntime runtime = ForgeCorePreferences.INSTANCE.getDefaultRuntime();
if (runtime == null || ForgeRuntime.STATE_NOT_RUNNING.equals(runtime.getState())) return;
Job job = new Job("Stopping Forge " + runtime.getVersion()) {
@Override
Expand All @@ -51,17 +51,17 @@ protected IStatus run(IProgressMonitor monitor) {
}

public static boolean isForgeRunning() {
ForgeRuntime runtime = ForgeRuntimesPreferences.INSTANCE.getDefaultRuntime();
ForgeRuntime runtime = ForgeCorePreferences.INSTANCE.getDefaultRuntime();
return runtime != null && ForgeRuntime.STATE_RUNNING.equals(runtime.getState());
}

public static boolean isForgeStarting() {
ForgeRuntime runtime = ForgeRuntimesPreferences.INSTANCE.getDefaultRuntime();
ForgeRuntime runtime = ForgeCorePreferences.INSTANCE.getDefaultRuntime();
return runtime != null && ForgeRuntime.STATE_STARTING.equals(runtime.getState());
}

public static ForgeRuntime getDefaultRuntime() {
return ForgeRuntimesPreferences.INSTANCE.getDefaultRuntime();
return ForgeCorePreferences.INSTANCE.getDefaultRuntime();
}

}
Loading

0 comments on commit 3c0b19e

Please sign in to comment.