1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-25 09:55:29 +02:00

Consolidate messages into one location.

Change-Id: I2a75c258799741c2f5f439ed2909a8fed1f2889f
Signed-off-by: Greg Watson <g.watson@computer.org>
This commit is contained in:
Greg Watson 2015-06-08 22:09:29 -04:00
parent 5907fb956d
commit 0bd36cccdd
7 changed files with 27 additions and 31 deletions

View file

@ -114,6 +114,13 @@ public class Messages extends NLS {
public static String RemoteUIServicesProxy_1;
public static String RemoteUIServicesProxy_2;
public static String CloseConnectionHandler_0;
public static String CloseConnectionHandler_1;
public static String DeleteRemoteConnectionHandler_ConfirmDeleteMessage;
public static String DeleteRemoteConnectionHandler_DeleteConnectionTitle;
public static String OpenConnectionHandler_0;
public static String OpenConnectionHandler_1;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);

View file

@ -1,4 +1,3 @@
AbstractRemoteUIConnectionManager_Could_not_open_connection=Could not open connection
###############################################################################
# Copyright (c) 2007 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
@ -6,6 +5,7 @@ AbstractRemoteUIConnectionManager_Could_not_open_connection=Could not open conne
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
###############################################################################
AbstractRemoteUIConnectionManager_Could_not_open_connection=Could not open connection
AbstractRemoteUIConnectionManager_Connection_Error=Connection Error
ConnectionsPreferencePage_Add=Add
ConnectionsPreferencePage_Close=Close
@ -66,3 +66,9 @@ RemoteResourceBrowserWidget_Unable_to_create_new_folder=Unable to create new fol
RemoteUIServices_Configuring_remote_services=Configuring remote services...
RemoteUIServicesProxy_1=Missing {0} attribute
RemoteUIServicesProxy_2=Failed to instantiate factory: {0} in type: {1} in plugin: {2}
CloseConnectionHandler_0=Closing connections
CloseConnectionHandler_1=Error closing connections
DeleteRemoteConnectionHandler_ConfirmDeleteMessage=Delete connection
DeleteRemoteConnectionHandler_DeleteConnectionTitle=Delete Connection
OpenConnectionHandler_0=Opening connections
OpenConnectionHandler_1=Error opening connections

View file

@ -17,6 +17,7 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.remote.core.IRemoteConnection;
import org.eclipse.remote.core.IRemoteConnectionControlService;
import org.eclipse.remote.internal.ui.RemoteUIPlugin;
import org.eclipse.remote.internal.ui.messages.Messages;
import org.eclipse.ui.handlers.HandlerUtil;
public class CloseConnectionHandler extends AbstractHandler {
@ -38,10 +39,12 @@ public class CloseConnectionHandler extends AbstractHandler {
}
new Job(Messages.CloseConnectionHandler_0) {
@Override
protected IStatus run(IProgressMonitor monitor) {
List<IStatus> status = new ArrayList<>();
for (IRemoteConnection connection : connections) {
IRemoteConnectionControlService controlService = connection.getService(IRemoteConnectionControlService.class);
IRemoteConnectionControlService controlService = connection
.getService(IRemoteConnectionControlService.class);
if (controlService != null) {
controlService.close();
}
@ -50,7 +53,8 @@ public class CloseConnectionHandler extends AbstractHandler {
if (status.isEmpty()) {
return Status.OK_STATUS;
} else {
return new MultiStatus(RemoteUIPlugin.PLUGIN_ID, 1, status.toArray(new IStatus[status.size()]), Messages.CloseConnectionHandler_1, null);
return new MultiStatus(RemoteUIPlugin.PLUGIN_ID, 1, status.toArray(new IStatus[status.size()]),
Messages.CloseConnectionHandler_1, null);
}
}
}.schedule();

View file

@ -25,6 +25,7 @@ import org.eclipse.remote.core.IRemoteConnection;
import org.eclipse.remote.core.IRemoteConnectionType;
import org.eclipse.remote.core.exception.RemoteConnectionException;
import org.eclipse.remote.internal.ui.RemoteUIPlugin;
import org.eclipse.remote.internal.ui.messages.Messages;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.handlers.HandlerUtil;

View file

@ -1,20 +0,0 @@
package org.eclipse.remote.internal.ui.views;
import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.remote.internal.ui.views.messages"; //$NON-NLS-1$
public static String CloseConnectionHandler_0;
public static String CloseConnectionHandler_1;
public static String DeleteRemoteConnectionHandler_ConfirmDeleteMessage;
public static String DeleteRemoteConnectionHandler_DeleteConnectionTitle;
public static String OpenConnectionHandler_0;
public static String OpenConnectionHandler_1;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
}
private Messages() {
}
}

View file

@ -18,6 +18,7 @@ import org.eclipse.remote.core.IRemoteConnection;
import org.eclipse.remote.core.IRemoteConnectionControlService;
import org.eclipse.remote.core.exception.RemoteConnectionException;
import org.eclipse.remote.internal.ui.RemoteUIPlugin;
import org.eclipse.remote.internal.ui.messages.Messages;
import org.eclipse.ui.handlers.HandlerUtil;
public class OpenConnectionHandler extends AbstractHandler {
@ -39,10 +40,12 @@ public class OpenConnectionHandler extends AbstractHandler {
}
new Job(Messages.OpenConnectionHandler_0) {
@Override
protected IStatus run(IProgressMonitor monitor) {
List<IStatus> status = new ArrayList<>();
for (IRemoteConnection connection : connections) {
IRemoteConnectionControlService controlService = connection.getService(IRemoteConnectionControlService.class);
IRemoteConnectionControlService controlService = connection
.getService(IRemoteConnectionControlService.class);
if (controlService != null) {
try {
controlService.open(monitor);
@ -55,7 +58,8 @@ public class OpenConnectionHandler extends AbstractHandler {
if (status.isEmpty()) {
return Status.OK_STATUS;
} else {
return new MultiStatus(RemoteUIPlugin.PLUGIN_ID, 1, status.toArray(new IStatus[status.size()]), Messages.OpenConnectionHandler_1, null);
return new MultiStatus(RemoteUIPlugin.PLUGIN_ID, 1, status.toArray(new IStatus[status.size()]),
Messages.OpenConnectionHandler_1, null);
}
}
}.schedule();

View file

@ -1,6 +0,0 @@
CloseConnectionHandler_0=Closing connections
CloseConnectionHandler_1=Error closing connections
DeleteRemoteConnectionHandler_ConfirmDeleteMessage=Delete connection
DeleteRemoteConnectionHandler_DeleteConnectionTitle=Delete Connection
OpenConnectionHandler_0=Openning connections
OpenConnectionHandler_1=Error openning connections