Permalink
Browse files

Plugin autostarting added: if 'hide status' or 'hide menu' checkbox is

checked, then plugin starts automatically.
  • Loading branch information...
1 parent 2df44f0 commit 8b57b269c030bef9d25b78c51c1ff8ac3c1f7d9f Guram Z. Savinov committed Aug 31, 2011
Showing with 23 additions and 8 deletions.
  1. +1 −1 META-INF/MANIFEST.MF
  2. +3 −0 plugin.xml
  3. +19 −7 src/org/ugosan/eclipse/fullscreen/FullScreenActivator.java
View
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Fullscreen Plug-in
Bundle-SymbolicName: org.ugosan.eclipse.fullscreen;singleton:=true
-Bundle-Version: 1.0.8
+Bundle-Version: 1.0.9
Bundle-RequiredExecutionEnvironment: J2SE-1.3
Bundle-Vendor: Ugo Sangiorgi and Daoen Pan
Require-Bundle: org.eclipse.ui;bundle-version="3.4.0",
View
@@ -70,5 +70,8 @@
class="org.ugosan.eclipse.fullscreen.FullScreenPreferenceInitializer">
</initializer>
</extension>
+ <extension
+ point="org.eclipse.ui.startup">
+ </extension>
</plugin>
@@ -18,25 +18,20 @@
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IViewSite;
+import org.eclipse.ui.IStartup;
import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
import org.osgi.service.prefs.Preferences;
-public class FullScreenActivator extends AbstractUIPlugin {
+public class FullScreenActivator extends AbstractUIPlugin implements IStartup {
public static final String ID = "org.ugosan.eclipse.fullscreen"; //$NON-NLS-1$
public static final String HIDE_MENU_BAR = "hide_menu_bar"; //$NON-NLS-1$
@@ -146,4 +141,21 @@ private boolean getHideStatusBar() {
.getRootNode().node(InstanceScope.SCOPE).node(ID);
return preferences.getBoolean(HIDE_STATUS_BAR, true);
}
+
+ public void earlyStartup() {
+ if ( !(getHideMenuBar() && getHideStatusBar()) ) {
+ return;
+ }
+
+ final IWorkbench workbench = PlatformUI.getWorkbench();
+ workbench.getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
+ if (window != null) {
+ Shell mainShell = window.getShell();
+ getDefault().setFullScreen(mainShell, true);
+ }
+ }
+ });
+ }
}

0 comments on commit 8b57b26

Please sign in to comment.