Skip to content

Commit

Permalink
533743: Use CTabFolder for Marketplace Tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
creckord committed May 23, 2018
1 parent ece9af8 commit ddbd210
Show file tree
Hide file tree
Showing 9 changed files with 152 additions and 56 deletions.
6 changes: 6 additions & 0 deletions org.eclipse.epp.mpc.core/.project
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,14 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,8 @@
import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.widgetOfType;
import static org.eclipse.swtbot.swt.finder.waits.Conditions.shellIsActive;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;

import java.io.File;
import java.lang.management.ManagementFactory;
Expand Down Expand Up @@ -55,12 +47,12 @@
import org.eclipse.equinox.internal.p2.ui.discovery.wizards.CatalogFilter;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CTabItem;
import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.swt.widgets.Widget;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.eclipse.finder.matchers.WidgetMatcherFactory;
Expand All @@ -79,12 +71,12 @@
import org.eclipse.swtbot.swt.finder.waits.WaitForObjectCondition;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotBrowser;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotCTabItem;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotLabel;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotLink;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotStyledText;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTabItem;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
import org.eclipse.swtbot.swt.finder.widgets.TimeoutException;
import org.eclipse.ui.IEditorReference;
Expand Down Expand Up @@ -413,11 +405,11 @@ protected SWTBot itemBot(String id) {
}

protected void checkSelectedTab(String tabLabel) {
SWTBotTabItem searchTab = bot.tabItem(tabLabel);
final TabItem tab = searchTab.widget;
TabItem[] selection = UIThreadRunnable.syncExec((ArrayResult<TabItem>) () -> tab.getParent().getSelection());
assertEquals(1, selection.length);
assertSame(tab, selection[0]);
SWTBotCTabItem searchTab = bot.cTabItem(tabLabel);
final CTabItem tab = searchTab.widget;
CTabItem selection = UIThreadRunnable.syncExec((Result<CTabItem>) () -> tab.getParent().getSelection());
assertNotNull(selection);
assertSame(tab, selection);
}

protected void filterMarket(String term) {
Expand Down
16 changes: 15 additions & 1 deletion org.eclipse.epp.mpc.ui.css/css/e4-dark_mpc.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
IEclipsePreferences#org-eclipse-epp-mpc-ui:org-eclipse-ui-themes { /* pseudo attribute added to allow contributions to switch between native and CSS borders globally */
preferences:
'native-borders=false'
}


.MarketplaceViewer,
.MarketplaceViewer > *,
.MarketplaceItem,
Expand Down Expand Up @@ -28,7 +34,15 @@
.CatalogSwitcher,
.CatalogSwitcher > ScrolledComposite,
.CatalogSwitcher > ScrolledComposite > *,
.Catalog {
.Catalog,
.Catalog > * {
background-color: #383C3E;
color: #dddddd;
}

#MarketplacePage CTabItem:selected,
#MarketplaceContent,
.MarketplaceSearchHeader,
.MarketplaceSearchHeader > Label {
background-color: '#org-eclipse-ui-workbench-ACTIVE_TAB_BG_END';
}
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,9 @@ private URL getStylesheet(ITheme theme, String path) {
public URL getCurrentThemeStylesheet(String path) {
return getStylesheet(getCurrentTheme(), path);
}

public StyleHelper applyStyles() {
getCSSEngine().applyStyles(widget, true);
return this;
}
}
Binary file added org.eclipse.epp.mpc.ui/icons/news_update.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.preferences.IPreferencesService;
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.epp.internal.mpc.core.MarketplaceClientCore;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.engine.IProfile;
Expand Down Expand Up @@ -252,4 +255,10 @@ private static boolean runIn(Display display, Runnable runnable) {
}
}
}

public static boolean useNativeBorders() {
IPreferencesService service = Platform.getPreferencesService();
return service.getBoolean(BUNDLE_ID, "native-borders", true,
new IScopeContext[] { InstanceScope.INSTANCE });
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ protected ImageRegistry createImageRegistry() {
}

imageRegistry.put(NEWS_ICON_UPDATE,
imageDescriptorFromPlugin(getBundle().getSymbolicName(), "icons/news_update.gif")); //$NON-NLS-1$
imageDescriptorFromPlugin(getBundle().getSymbolicName(), "icons/news_update.png")); //$NON-NLS-1$
imageRegistry.put(ITEM_ICON_STAR, imageDescriptorFromPlugin(getBundle().getSymbolicName(), "icons/star.png")); //$NON-NLS-1$
imageRegistry.put(ITEM_ICON_STAR_SELECTED,
imageDescriptorFromPlugin(getBundle().getSymbolicName(), "icons/star-selected.png")); //$NON-NLS-1$
Expand Down
Loading

0 comments on commit ddbd210

Please sign in to comment.