Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2012 - 2018 Wind River Systems, Inc. and others. All rights reserved.
* Copyright (c) 2012 - 2025 Wind River Systems, Inc. and others. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License 2.0 which accompanies this distribution, and is
* available at https://www.eclipse.org/legal/epl-2.0/
Expand All @@ -8,19 +8,17 @@
*
* Contributors:
* Wind River Systems - initial API and implementation
* Alexander Fedorov (ArSysOp) - further evolution
*******************************************************************************/
package org.eclipse.terminal.connector.local.activator;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.swt.graphics.Image;
import org.eclipse.terminal.view.core.ITerminalService;
import org.eclipse.terminal.view.core.utils.ScopedEclipsePreferences;
import org.eclipse.terminal.view.core.utils.TraceHandler;
import org.eclipse.terminal.view.ui.launcher.ILaunchDelegateManager;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
import org.osgi.util.tracker.ServiceTracker;

/**
* The activator class controls the plug-in life cycle
Expand Down Expand Up @@ -121,25 +119,4 @@ public static ImageDescriptor getImageDescriptor(String key) {
return getDefault().getImageRegistry().getDescriptor(key);
}

private static ServiceTracker<ITerminalService, ITerminalService> terminalServiceTracker;

public static synchronized ITerminalService getTerminalService() {
if (terminalServiceTracker == null) {
terminalServiceTracker = new ServiceTracker<>(getDefault().getBundle().getBundleContext(),
ITerminalService.class, null);
terminalServiceTracker.open();
}
return terminalServiceTracker.getService();
}

private static ServiceTracker<ILaunchDelegateManager, ILaunchDelegateManager> launchDelegateServiceTracker;

public static synchronized ILaunchDelegateManager getLaunchDelegateManager() {
if (launchDelegateServiceTracker == null) {
launchDelegateServiceTracker = new ServiceTracker<>(getDefault().getBundle().getBundleContext(),
ILaunchDelegateManager.class, null);
launchDelegateServiceTracker.open();
}
return launchDelegateServiceTracker.getService();
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2012, 2018 Wind River Systems, Inc. and others. All rights reserved.
* Copyright (c) 2012, 2025 Wind River Systems, Inc. and others. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License 2.0 which accompanies this distribution, and is
* available at https://www.eclipse.org/legal/epl-2.0/
Expand All @@ -9,6 +9,7 @@
* Contributors:
* Wind River Systems - initial API and implementation
* Dirk Fauth <dirk.fauth@googlemail.com> - Bug 460496
* Alexander Fedorov (ArSysOp) - further evolution
*******************************************************************************/
package org.eclipse.terminal.connector.local.launcher;

Expand All @@ -22,6 +23,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Optional;

import org.eclipse.cdt.utils.pty.PTY;
import org.eclipse.core.runtime.Assert;
Expand Down Expand Up @@ -220,13 +222,8 @@ public void execute(Map<String, Object> properties, ITerminalService.Done done)
}
}
}

// Get the terminal service
ITerminalService terminal = UIPlugin.getTerminalService();
// If not available, we cannot fulfill this request
if (terminal != null) {
terminal.openConsole(properties, done);
}
Optional.ofNullable(PlatformUI.getWorkbench().getService(ITerminalService.class))
.ifPresent(s -> s.openConsole(properties, done));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.terminal.connector.local.activator.UIPlugin;
import org.eclipse.terminal.view.core.ITerminalsConnectorConstants;
import org.eclipse.terminal.view.ui.launcher.ILaunchDelegateManager;
import org.eclipse.terminal.view.ui.launcher.ILauncherDelegate;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IPathEditorInput;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.handlers.HandlerUtil;

/**
Expand Down Expand Up @@ -58,7 +59,7 @@ public Object execute(ExecutionEvent event) throws ExecutionException {
}

// Get all applicable launcher delegates for the current selection
List<ILauncherDelegate> delegates = UIPlugin.getLaunchDelegateManager()
List<ILauncherDelegate> delegates = PlatformUI.getWorkbench().getService(ILaunchDelegateManager.class)
.getApplicableLauncherDelegates(selection);
// Find the local terminal launcher delegate
ILauncherDelegate delegate = null;
Expand Down
Loading