@SuppressWarnings("unchecked") protected <C extends IConnection> ConnectionWizardPage( IWizard wizard, IConnectionAware<C> wizardModel, Class<? extends IConnection> connectionType, boolean allowConnectionChange) { super( "Sign in to OpenShift", "Please sign in to your OpenShift server.", "Server Connection", wizard); this.pageModel = new ConnectionWizardPageModel( wizardModel.getConnection(), ConnectionsRegistrySingleton.getInstance().getAll(), connectionType, allowConnectionChange, (IConnectionAware<IConnection>) wizardModel); /* * JBIDE-12999: ensure EclipseAuthenticator is installed and overrides * NetAuthenticator */ EGitUIUtils.ensureEgitUIIsStarted(); }
@Override public void stop(BundleContext context) throws Exception { plugin = null; if (connectionsRegistryListener != null) { ConnectionsRegistrySingleton.getInstance().removeListener(connectionsRegistryListener); connectionsRegistryListener = null; } super.stop(context); }
@Override public void start(BundleContext context) throws Exception { super.start(context); plugin = this; connectionsRegistryListener = new ConnectionsRegistryAdapter() { @Override public void connectionAdded(IConnection connection) { try { OpenShiftUIUtils.showOpenShiftExplorer(); } catch (Exception e) { // Can happen during workbench startup, while the core // plugins are starting. // Since mutiple connections would cause multiple errors, // it's probably better to swallow the exception, else a // user would see multiple // errors in the log, every time the workbench starts. } } }; ConnectionsRegistrySingleton.getInstance().addListener(connectionsRegistryListener); }
@Override public void received(IResource resource, ChangeType change) { Trace.debug("Watch received change in {0} state\n{1}", state, resource.toJson(false)); if (State.CONNECTED == state.get()) { IResource newItem = null; IResource oldItem = null; int index = resources.indexOf(resource); if (ChangeType.ADDED.equals(change)) { resources.add(resource); newItem = resource; } else if (ChangeType.DELETED.equals(change)) { oldItem = index > NOT_FOUND ? resources.remove(index) : resource; } else if (ChangeType.MODIFIED.equals(change)) { if (index > NOT_FOUND) { oldItem = resources.remove(index); } resources.add(resource); newItem = resource; } ConnectionsRegistrySingleton.getInstance() .fireConnectionChanged(conn, ConnectionProperties.PROPERTY_RESOURCE, oldItem, newItem); } }
private WatchManager() { ConnectionsRegistrySingleton.getInstance().addListener(new DeletedConnectionListener()); }