@Override public List<ExecutionEnvironment> getEnvironments() { return Arrays.asList(record.getExecutionEnvironment()); }
private static void invokeLongAction(final ServerRecord record, final CancellableTask actionWorker) { CancellableTask wrapper; if (!record.isDeleted() && record.isOnline()) { wrapper = actionWorker; } else { String message; if (record.isDeleted()) { message = MessageFormat.format(getString("ERR_RequestingDeletedConnection"), record.getDisplayName()); int res = JOptionPane.showConfirmDialog(WindowManager.getDefault().getMainWindow(), message, getString("DLG_TITLE_DeletedConnection"), JOptionPane.YES_NO_OPTION); if (res == JOptionPane.YES_OPTION) { ServerList.addServer(record.getExecutionEnvironment(), record.getDisplayName(), record.getSyncFactory(), false, true); } else { return; String msg = NbBundle.getMessage(MakeActionProvider.class, "MSG_Validate_Host", record.getDisplayName()); String title = NbBundle.getMessage(MakeActionProvider.class, "DLG_TITLE_Validate_Host"); ModalMessageDlg.runLongTask(mainWindow, wrapper, null, wrapper, title, msg);
protected static boolean checkConnection(ExecutionEnvironment execEnv) { if (execEnv.isRemote()) { try { ConnectionManager.getInstance().connectTo(execEnv); ServerRecord record = ServerList.get(execEnv); if (record.isOffline()) { record.validate(true); } return record.isOnline(); } catch (IOException ex) { return false; } catch (CancellationException ex) { return false; } } else { return true; } }
@Override public void propertyChange(PropertyChangeEvent evt) { if (ServerRecord.PROP_STATE_CHANGED.equals(evt.getPropertyName())) { if (ServerList.get(env).isOnline()) { RP.post(runnable); ServerList.get(env).removePropertyChangeListener(this); } } } });
final ServerRecord currRecord = ServerList.get(currEnv); if (currRecord.getDisplayName().equals(v)) { final int newValue = i; final Runnable setter = new Runnable() { if (currRecord.isSetUp()) { setter.run(); } else {
private boolean areToolsOptionsChanged() { if(!ServerList.getDefaultRecord().getExecutionEnvironment().equals(tcm.getDefaultHostRecord().getExecutionEnvironment())) { return true; ServerRecord savedRecord = savedHostsIter.next(); ServerRecord currentRecord = currentHostsIter.next(); if (!savedRecord.getExecutionEnvironment().equals(currentRecord.getExecutionEnvironment()) || !savedRecord.getSyncFactory().getID().equals(currentRecord.getSyncFactory().getID()) || savedRecord.getX11Forwarding() != currentRecord.getX11Forwarding() || savedRecord.isRememberPassword() != currentRecord.isRememberPassword() || !savedRecord.getDisplayName().equals(currentRecord.getDisplayName())) { return true;
@Override public void runImpl() { try { if (!ConnectionManager.getInstance().isConnectedTo(record.getExecutionEnvironment())) { ConnectionManager.getInstance().connectTo(record.getExecutionEnvironment()); } record.validate(true); // initialize compiler sets for remote host if needed CompilerSetManager csm = CompilerSetManager.get(record.getExecutionEnvironment()); csm.initialize(true, true, null); } catch (CancellationException ex) { cancel(); } catch (Exception e) { e.printStackTrace(System.err); final String message = MessageFormat.format(getString("ERR_Cant_Connect"), record.getDisplayName()); //NOI18N final String title = getString("DLG_TITLE_Cant_Connect"); //NOI18N SwingUtilities.invokeLater(new Runnable() { @Override public void run() { JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), message, title, JOptionPane.ERROR_MESSAGE); } }); } if (record.isOnline()) { actionWorker.run(); } } };
/*package*/ static boolean syncValidate(final String name) { if (name != null && name.equals("localhost")) { // NOI18N return true; } Host host = Host.byName(name); final ServerRecord serverRecord = ServerList.get(host.executionEnvironment()); serverRecord.validate(true); // No need to continue if connection is not available if (!serverRecord.isOnline()) { showErrorDialog(serverRecord); return false; } ExecutionEnvironment exEnv = serverRecord.getExecutionEnvironment(); CompilerSetManager csm = CompilerSetManager.get(exEnv); csm.initialize(true, true, null); // initialize host info PlatformInfo.getDefault(exEnv); return true; }
if (servers.size() > 1) { for (ServerRecord record : servers) { for (CompilerSet cs : getCompilerSetManager(record.getExecutionEnvironment()).getCompilerSets()) { CompilerSetPresenter csp = new CompilerSetPresenter(cs, record.getExecutionEnvironment(), record.getDisplayName() + " : " + cs.getName()); //NOI18N if (csToSelect == cs) { toSelect.set(csp); assert ! servers.iterator().next().isRemote();
@Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); if (loadingMarker.equals(value)) { label.setText(NbBundle.getMessage(PanelProjectLocationVisual.class, "Loading_Host_Text")); // NOI18N } else { ServerRecord rec = (ServerRecord) value; if (rec != null) { label.setText(rec.getDisplayName()); } } return label; } }
public static boolean isDevHostValid(ExecutionEnvironment env) { ServerRecord record = ServerList.get(env); return record != null && record.isOnline(); }
private static Pair<ExecutionEnvironment, RemoteSyncFactory> getEnv(Project project) { if (project != null) { RemoteProject info = project.getLookup().lookup(RemoteProject.class); if (info != null) { ExecutionEnvironment dh = info.getDevelopmentHost(); if (dh != null) { return Pair.of(dh, info.getSyncFactory()); } } } ServerRecord rec = ServerList.getDefaultRecord(); return Pair.of(rec.getExecutionEnvironment(), rec.getSyncFactory()); }
if (r.isSetUp()) { records.add(r); if (serverRecord.isSetUp() && !serverRecord.isDeleted()) { CompilerSetManager csm; if (toolsCacheManager != null && ee != null) { csm = toolsCacheManager.getCompilerSetManagerCopy(ee, false); } else { csm = CompilerSetManager.get(serverRecord.getExecutionEnvironment());
srToSelect = null; if (srToSelect == null || srToSelect.isDeleted()) { srToSelect = ServerList.getDefaultRecord(); CompilerSetManager csm; if (toolsCacheManager == null) { csm = CompilerSetManager.get(srToSelect.getExecutionEnvironment()); } else { csm = toolsCacheManager.getCompilerSetManagerCopy(srToSelect.getExecutionEnvironment(), false);
JRadioButtonMenuItem jmi = new JRadioButtonMenuItem(record.getServerDisplayName(), currExecEnv.equals(record.getExecutionEnvironment())); subMenu.add(jmi); jmi.putClientProperty(HOST_ENV, record.getExecutionEnvironment()); jmi.putClientProperty(CONF, mconf); jmi.putClientProperty(PROJECT, project);
public void validate(final ExecutionEnvironment env, final CompilerSetManagerImpl csm) { if (DISABLED || Installer.isClosed()) { return; } final Runnable runnable = new Runnable() { @Override public void run() { validateImpl(env, csm); } }; boolean postpone = env.isRemote() && ! ServerList.get(env).isOnline(); if (postpone) { ServerList.get(env).addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (ServerRecord.PROP_STATE_CHANGED.equals(evt.getPropertyName())) { if (ServerList.get(env).isOnline()) { RP.post(runnable); ServerList.get(env).removePropertyChangeListener(this); } } } }); } else { RP.post(runnable); } }
public void runProjectReadiness(NamedRunnable task) { if (executionEnvironment.isLocal() || isCodeModelInfoReady) { task.run(); } else { tasks.add(task); final ServerRecord record = ServerList.get(executionEnvironment); if (record.isOffline()) { ConnectionNotifier.addTask(executionEnvironment, new ConnectionNotifier.NamedRunnable(task.getName()) { @Override protected void runImpl() { record.checkSetupAfterConnection(new Runnable(){ @Override public void run() { ToolsCacheManager cacheManager = ToolsCacheManager.createInstance(true); CompilerSetManager csm = cacheManager.getCompilerSetManagerCopy(record.getExecutionEnvironment(), false); csm.initialize(false, true, null); cacheManager.applyChanges(); } }); } }); } } }
if (ServerList.get(execEnv).getX11Forwarding() && !env.containsKey("DISPLAY")) { //NOI18N if DISPLAY is set, let it do its work npb.setX11Forwarding(true);