Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added plugin that hides 'Install New Software…' and a preference to b…
…ring it back. This plugin adds a top level menu named 'Advanced'. This menu will only be visible if the Advanced preference is checked. The advanced feature also adds the 'Plugin-spy' that enables the user to see which plugin contributed the selected element. ( Alt-Shift-F1 ) or menus with ( Alt-Shift-F2 )
- Loading branch information
Showing
14 changed files
with
379 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>net.bioclipse.advanced_feature</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.pde.FeatureBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.pde.FeatureNature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
bin.includes = feature.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<feature | ||
id="net.bioclipse.advanced_feature" | ||
label="Advanced" | ||
version="2.5.0.qualifier"> | ||
|
||
<description> | ||
Enables menu with more advanced options for installing features. Alos provides the plugin-spy for developers. | ||
</description> | ||
|
||
<copyright url="http://www.example.com/copyright"> | ||
[Enter Copyright Description here.] | ||
</copyright> | ||
|
||
<license url="http://www.example.com/license"> | ||
[Enter License Description here.] | ||
</license> | ||
|
||
<plugin | ||
id="net.bioclipse.ui.advanced" | ||
download-size="0" | ||
install-size="0" | ||
version="0.0.0" | ||
unpack="false"/> | ||
|
||
<plugin | ||
id="org.eclipse.pde.runtime" | ||
download-size="0" | ||
install-size="0" | ||
version="0.0.0" | ||
unpack="false"/> | ||
|
||
</feature> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> | ||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>net.bioclipse.ui.advanced</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.pde.ManifestBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.pde.SchemaBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.pde.PluginNature</nature> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Manifest-Version: 1.0 | ||
Bundle-ManifestVersion: 2 | ||
Bundle-Name: Advanced Functionality | ||
Bundle-SymbolicName: net.bioclipse.ui.advanced;singleton:=true | ||
Bundle-Version: 2.5.0.qualifier | ||
Bundle-Activator: net.bioclipse.ui.advanced.Activator | ||
Bundle-ActivationPolicy: lazy | ||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 | ||
Import-Package: org.eclipse.core.expressions, | ||
org.eclipse.core.runtime.preferences;version="3.3.0", | ||
org.eclipse.ui.plugin, | ||
org.osgi.framework;version="1.6.0" | ||
Require-Bundle: org.eclipse.ui;bundle-version="3.7.0", | ||
org.eclipse.core.runtime;bundle-version="3.7.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
source.. = src/ | ||
output.. = bin/ | ||
bin.includes = META-INF/,\ | ||
.,\ | ||
plugin.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<?eclipse version="3.4"?> | ||
<plugin> | ||
<extension | ||
id="net.bioclipse.ui.advanced.menu" | ||
point="org.eclipse.ui.menus"> | ||
<menuContribution | ||
allPopups="false" | ||
locationURI="menu:org.eclipse.ui.main.menu?after=help"> | ||
<menu | ||
id="menu" | ||
label="Advanced"> | ||
<command | ||
commandId="org.eclipse.equinox.p2.ui.sdk.install" | ||
label="Install New Software…" | ||
style="push"> | ||
</command> | ||
</menu> | ||
</menuContribution> | ||
</extension> | ||
<extension | ||
point="org.eclipse.ui.activities"> | ||
<activity | ||
description="Enabels some advanced features for Bioclipse" | ||
id="net.bioclipse.advancedMode" | ||
name="Advanced Mode"> | ||
<enabledWhen> | ||
<with | ||
variable="net.bioclipse.ui.advances.AdvancedState"> | ||
<equals | ||
value="Enabled"> | ||
</equals> | ||
</with> | ||
</enabledWhen> | ||
</activity> | ||
<activityPatternBinding | ||
activityId="net.bioclipse.advancedMode" | ||
isEqualityPattern="false" | ||
pattern="net.bioclipse.ui.advanced/.*menu"> | ||
</activityPatternBinding> | ||
</extension> | ||
<extension | ||
point="org.eclipse.ui.preferencePages"> | ||
<page | ||
class="net.bioclipse.ui.advanced.preferences.AdvancedPreferencePage" | ||
id="net.bioclipse.ui.advanced.preferences.AdvancedPreferencePage" | ||
name="Advanced Mode"> | ||
</page> | ||
</extension> | ||
<extension | ||
point="org.eclipse.core.runtime.preferences"> | ||
<initializer | ||
class="net.bioclipse.ui.advanced.preferences.PreferenceInitializer"> | ||
</initializer> | ||
</extension> | ||
<extension | ||
point="org.eclipse.ui.services"> | ||
<sourceProvider | ||
provider="net.bioclipse.ui.advanced.AdvancedEnabledSourceProvider"> | ||
<variable | ||
name="net.bioclipse.ui.advances.AdvancedState" | ||
priorityLevel="workbench"> | ||
</variable> | ||
</sourceProvider> | ||
</extension> | ||
|
||
</plugin> |
50 changes: 50 additions & 0 deletions
50
plugins/net.bioclipse.ui.advanced/src/net/bioclipse/ui/advanced/Activator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package net.bioclipse.ui.advanced; | ||
|
||
import org.eclipse.ui.plugin.AbstractUIPlugin; | ||
import org.osgi.framework.BundleContext; | ||
|
||
/** | ||
* The activator class controls the plug-in life cycle | ||
*/ | ||
public class Activator extends AbstractUIPlugin { | ||
|
||
// The plug-in ID | ||
public static final String PLUGIN_ID = "net.bioclipse.ui.advanced"; //$NON-NLS-1$ | ||
|
||
// The shared instance | ||
private static Activator plugin; | ||
|
||
/** | ||
* The constructor | ||
*/ | ||
public Activator() { | ||
} | ||
|
||
/* | ||
* (non-Javadoc) | ||
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) | ||
*/ | ||
public void start(BundleContext context) throws Exception { | ||
super.start(context); | ||
plugin = this; | ||
} | ||
|
||
/* | ||
* (non-Javadoc) | ||
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) | ||
*/ | ||
public void stop(BundleContext context) throws Exception { | ||
plugin = null; | ||
super.stop(context); | ||
} | ||
|
||
/** | ||
* Returns the shared instance | ||
* | ||
* @return the shared instance | ||
*/ | ||
public static Activator getDefault() { | ||
return plugin; | ||
} | ||
|
||
} |
69 changes: 69 additions & 0 deletions
69
...et.bioclipse.ui.advanced/src/net/bioclipse/ui/advanced/AdvancedEnabledSourceProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package net.bioclipse.ui.advanced; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import net.bioclipse.ui.advanced.preferences.PreferenceConstants; | ||
|
||
import org.eclipse.core.runtime.preferences.IEclipsePreferences; | ||
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener; | ||
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent; | ||
import org.eclipse.core.runtime.preferences.InstanceScope; | ||
import org.eclipse.ui.AbstractSourceProvider; | ||
import org.eclipse.ui.ISources; | ||
import org.osgi.service.prefs.Preferences; | ||
|
||
|
||
public class AdvancedEnabledSourceProvider extends AbstractSourceProvider { | ||
|
||
public final static String ADVANCED_STATE = "net.bioclipse.ui.advances.AdvancedState"; | ||
|
||
private final static String ENABLED = "Enabled"; | ||
private final static String DISABLED = "Disabled"; | ||
public AdvancedEnabledSourceProvider() { | ||
|
||
IEclipsePreferences pref = InstanceScope.INSTANCE | ||
.getNode( "net.bioclipse.ui.advanced" );; | ||
pref.addPreferenceChangeListener( new IPreferenceChangeListener() { | ||
|
||
@Override | ||
public void preferenceChange( PreferenceChangeEvent event ) { | ||
|
||
fireSourceChanged( ISources.WORKBENCH, ADVANCED_STATE, | ||
currentState( event.getNewValue() ) ); | ||
} | ||
} ); | ||
} | ||
|
||
private String currentState( Object state ) { | ||
|
||
if ( state instanceof String ) | ||
return ((String) state).equals( "true" ) ? ENABLED : DISABLED; | ||
else | ||
return DISABLED; | ||
} | ||
@Override | ||
public void dispose() { | ||
|
||
// TODO Auto-generated method stub | ||
|
||
} | ||
|
||
@Override | ||
public Map getCurrentState() { | ||
Map<String,String> currentState = new HashMap<String,String>(1); | ||
Preferences preference = InstanceScope.INSTANCE | ||
.getNode( "net.bioclipse.ui.advanced" ); | ||
String state = preference.getBoolean( PreferenceConstants.P_BOOLEAN, | ||
false ) ? ENABLED : DISABLED; | ||
currentState.put( ADVANCED_STATE, state ); | ||
return currentState; | ||
} | ||
|
||
@Override | ||
public String[] getProvidedSourceNames() { | ||
|
||
return new String[] { ADVANCED_STATE }; | ||
} | ||
|
||
} |
54 changes: 54 additions & 0 deletions
54
...oclipse.ui.advanced/src/net/bioclipse/ui/advanced/preferences/AdvancedPreferencePage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package net.bioclipse.ui.advanced.preferences; | ||
|
||
import net.bioclipse.ui.advanced.Activator; | ||
|
||
import org.eclipse.jface.preference.BooleanFieldEditor; | ||
import org.eclipse.jface.preference.FieldEditorPreferencePage; | ||
import org.eclipse.ui.IWorkbench; | ||
import org.eclipse.ui.IWorkbenchPreferencePage; | ||
|
||
/** | ||
* This class represents a preference page that | ||
* is contributed to the Preferences dialog. By | ||
* subclassing <samp>FieldEditorPreferencePage</samp>, we | ||
* can use the field support built into JFace that allows | ||
* us to create a page that is small and knows how to | ||
* save, restore and apply itself. | ||
* <p> | ||
* This page is used to modify preferences only. They | ||
* are stored in the preference store that belongs to | ||
* the main plug-in class. That way, preferences can | ||
* be accessed directly via the preference store. | ||
*/ | ||
|
||
public class AdvancedPreferencePage | ||
extends FieldEditorPreferencePage | ||
implements IWorkbenchPreferencePage { | ||
|
||
public AdvancedPreferencePage() { | ||
super(GRID); | ||
setPreferenceStore(Activator.getDefault().getPreferenceStore()); | ||
setDescription( "Enables a menu with advanced features such as the eclipse style 'Install New Software..' dialog" ); | ||
} | ||
|
||
/** | ||
* Creates the field editors. Field editors are abstractions of | ||
* the common GUI blocks needed to manipulate various types | ||
* of preferences. Each field editor knows how to save and | ||
* restore itself. | ||
*/ | ||
public void createFieldEditors() { | ||
addField( | ||
new BooleanFieldEditor( | ||
PreferenceConstants.P_BOOLEAN, | ||
"&Enable Advanced Mode", | ||
getFieldEditorParent())); | ||
} | ||
|
||
/* (non-Javadoc) | ||
* @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) | ||
*/ | ||
public void init(IWorkbench workbench) { | ||
} | ||
|
||
} |
10 changes: 10 additions & 0 deletions
10
....bioclipse.ui.advanced/src/net/bioclipse/ui/advanced/preferences/PreferenceConstants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package net.bioclipse.ui.advanced.preferences; | ||
|
||
/** | ||
* Constant definitions for plug-in preferences | ||
*/ | ||
public class PreferenceConstants { | ||
|
||
public static final String P_BOOLEAN = "booleanPreference"; | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
...ioclipse.ui.advanced/src/net/bioclipse/ui/advanced/preferences/PreferenceInitializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package net.bioclipse.ui.advanced.preferences; | ||
|
||
import net.bioclipse.ui.advanced.Activator; | ||
|
||
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; | ||
import org.eclipse.jface.preference.IPreferenceStore; | ||
|
||
/** | ||
* Class used to initialize default preference values. | ||
*/ | ||
public class PreferenceInitializer extends AbstractPreferenceInitializer { | ||
|
||
/* | ||
* (non-Javadoc) | ||
* | ||
* @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() | ||
*/ | ||
public void initializeDefaultPreferences() { | ||
IPreferenceStore store = Activator.getDefault().getPreferenceStore(); | ||
store.setDefault( PreferenceConstants.P_BOOLEAN, false ); | ||
} | ||
|
||
} |