mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Clean-up
This commit is contained in:
parent
89a9259918
commit
b4b53b3bc6
6 changed files with 391 additions and 508 deletions
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2010, 2012 Andrew Gvozdev and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Andrew Gvozdev - Initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.language.settings.providers;
|
package org.eclipse.cdt.internal.ui.language.settings.providers;
|
||||||
|
|
||||||
import org.eclipse.cdt.ui.dialogs.AbstractCOptionPage;
|
import org.eclipse.cdt.ui.dialogs.AbstractCOptionPage;
|
||||||
|
|
|
@ -95,14 +95,15 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
||||||
private static final int BUTTON_MOVE_UP = 4;
|
private static final int BUTTON_MOVE_UP = 4;
|
||||||
private static final int BUTTON_MOVE_DOWN = 5;
|
private static final int BUTTON_MOVE_DOWN = 5;
|
||||||
|
|
||||||
private final static String[] BUTTON_LABELS = {
|
private final static String[] BUTTON_LABELS = new String[6];
|
||||||
ADD_STR,
|
{
|
||||||
EDIT_STR,
|
BUTTON_LABELS[BUTTON_ADD] = ADD_STR;
|
||||||
DEL_STR,
|
BUTTON_LABELS[BUTTON_EDIT] = EDIT_STR;
|
||||||
null,
|
BUTTON_LABELS[BUTTON_DELETE] = DEL_STR;
|
||||||
MOVEUP_STR,
|
BUTTON_LABELS[BUTTON_MOVE_UP] = MOVEUP_STR;
|
||||||
MOVEDOWN_STR,
|
BUTTON_LABELS[BUTTON_MOVE_DOWN] = MOVEDOWN_STR;
|
||||||
};
|
}
|
||||||
|
|
||||||
private static final String CLEAR_STR = Messages.LanguageSettingsProviderTab_Clear;
|
private static final String CLEAR_STR = Messages.LanguageSettingsProviderTab_Clear;
|
||||||
|
|
||||||
private Map<String, List<ILanguageSettingsProvider>> initialProvidersMap = new HashMap<String, List<ILanguageSettingsProvider>>();
|
private Map<String, List<ILanguageSettingsProvider>> initialProvidersMap = new HashMap<String, List<ILanguageSettingsProvider>>();
|
||||||
|
@ -311,8 +312,21 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
||||||
return provider.getSettingEntries(cfgDescription, rc, currentLanguageId);
|
return provider.getSettingEntries(cfgDescription, rc, currentLanguageId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createTreeForLanguages(Composite comp) {
|
private void trackInitialSettings() {
|
||||||
treeLanguages = new Tree(comp, SWT.BORDER | SWT.SINGLE | SWT.H_SCROLL);
|
if (!page.isForPrefs()) {
|
||||||
|
ICConfigurationDescription[] cfgDescriptions = page.getCfgsEditable();
|
||||||
|
for (ICConfigurationDescription cfgDescription : cfgDescriptions) {
|
||||||
|
if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
|
||||||
|
String cfgId = cfgDescription.getId();
|
||||||
|
List<ILanguageSettingsProvider> initialProviders = ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders();
|
||||||
|
initialProvidersMap.put(cfgId, initialProviders);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createTreeForLanguages(Composite parent) {
|
||||||
|
treeLanguages = new Tree(parent, SWT.BORDER | SWT.SINGLE | SWT.H_SCROLL);
|
||||||
treeLanguages.setLayoutData(new GridData(GridData.FILL_VERTICAL));
|
treeLanguages.setLayoutData(new GridData(GridData.FILL_VERTICAL));
|
||||||
treeLanguages.setHeaderVisible(true);
|
treeLanguages.setHeaderVisible(true);
|
||||||
|
|
||||||
|
@ -347,8 +361,8 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createTreeForEntries(Composite comp) {
|
private void createTreeForEntries(Composite parent) {
|
||||||
treeEntries = new Tree(comp, SWT.BORDER | SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL);
|
treeEntries = new Tree(parent, SWT.BORDER | SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL);
|
||||||
treeEntries.setLayoutData(new GridData(GridData.FILL_VERTICAL));
|
treeEntries.setLayoutData(new GridData(GridData.FILL_VERTICAL));
|
||||||
treeEntries.setHeaderVisible(true);
|
treeEntries.setHeaderVisible(true);
|
||||||
treeEntries.setLinesVisible(true);
|
treeEntries.setLinesVisible(true);
|
||||||
|
@ -394,43 +408,24 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void trackInitialSettings() {
|
private void createSashForm() {
|
||||||
if (page.isForPrefs()) {
|
sashFormEntries = new SashForm(usercomp,SWT.HORIZONTAL);
|
||||||
// AG TODO
|
|
||||||
} else {
|
GridData gd = new GridData(GridData.FILL_BOTH);
|
||||||
ICConfigurationDescription[] cfgDescriptions = page.getCfgsEditable();
|
gd.horizontalSpan = 2;
|
||||||
for (ICConfigurationDescription cfgDescription : cfgDescriptions) {
|
gd.grabExcessVerticalSpace = true;
|
||||||
if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
|
sashFormEntries.setLayoutData(gd);
|
||||||
String cfgId = cfgDescription.getId();
|
|
||||||
List<ILanguageSettingsProvider> initialProviders = ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders();
|
GridLayout layout = new GridLayout();
|
||||||
initialProvidersMap.put(cfgId, initialProviders);
|
sashFormEntries.setLayout(layout);
|
||||||
}
|
|
||||||
}
|
createTreeForLanguages(sashFormEntries);
|
||||||
}
|
createTreeForEntries(sashFormEntries);
|
||||||
|
|
||||||
|
sashFormEntries.setWeights(DEFAULT_ENTRIES_SASH_WEIGHTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private void createBuiltInsCheckBox() {
|
||||||
public void createControls(Composite parent) {
|
|
||||||
super.createControls(parent);
|
|
||||||
currentLanguageId = null;
|
|
||||||
|
|
||||||
usercomp.setLayout(new GridLayout());
|
|
||||||
GridData gd = (GridData) usercomp.getLayoutData();
|
|
||||||
// Discourage settings entry table from trying to show all its items at once, see bug 264330
|
|
||||||
gd.heightHint =1;
|
|
||||||
|
|
||||||
if (page instanceof Page_LanguageSettingsProviders) {
|
|
||||||
masterPropertyPage = (Page_LanguageSettingsProviders) page;
|
|
||||||
}
|
|
||||||
|
|
||||||
trackInitialSettings();
|
|
||||||
|
|
||||||
createSashForm();
|
|
||||||
|
|
||||||
// Status line
|
|
||||||
fStatusLine = new StatusMessageLine(usercomp, SWT.LEFT, 2);
|
|
||||||
|
|
||||||
// "Show built-ins" checkbox
|
|
||||||
builtInCheckBox = setupCheck(usercomp, Messages.AbstractLangsListTab_ShowBuiltin, 1, GridData.FILL_HORIZONTAL);
|
builtInCheckBox = setupCheck(usercomp, Messages.AbstractLangsListTab_ShowBuiltin, 1, GridData.FILL_HORIZONTAL);
|
||||||
builtInCheckBox.addSelectionListener(new SelectionAdapter() {
|
builtInCheckBox.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -440,8 +435,9 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
||||||
});
|
});
|
||||||
builtInCheckBox.setSelection(true);
|
builtInCheckBox.setSelection(true);
|
||||||
builtInCheckBox.setEnabled(true);
|
builtInCheckBox.setEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
// "I want to try new scanner discovery" temporary checkbox
|
private void createEnableProvidersCheckBox() {
|
||||||
enableProvidersCheckBox = setupCheck(usercomp, Messages.CDTMainWizardPage_TrySD90, 2, GridData.FILL_HORIZONTAL);
|
enableProvidersCheckBox = setupCheck(usercomp, Messages.CDTMainWizardPage_TrySD90, 2, GridData.FILL_HORIZONTAL);
|
||||||
enableProvidersCheckBox.addSelectionListener(new SelectionAdapter() {
|
enableProvidersCheckBox.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -473,28 +469,34 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
||||||
// display but disable the checkbox for file/folder resource
|
// display but disable the checkbox for file/folder resource
|
||||||
enableProvidersCheckBox.setEnabled(page.isForProject());
|
enableProvidersCheckBox.setEnabled(page.isForProject());
|
||||||
enableTabControls(enableProvidersCheckBox.getSelection());
|
enableTabControls(enableProvidersCheckBox.getSelection());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void createControls(Composite parent) {
|
||||||
|
super.createControls(parent);
|
||||||
|
currentLanguageId = null;
|
||||||
|
|
||||||
|
usercomp.setLayout(new GridLayout());
|
||||||
|
GridData gd = (GridData) usercomp.getLayoutData();
|
||||||
|
// Discourage settings entry table from trying to show all its items at once, see bug 264330
|
||||||
|
gd.heightHint =1;
|
||||||
|
|
||||||
|
if (page instanceof Page_LanguageSettingsProviders) {
|
||||||
|
masterPropertyPage = (Page_LanguageSettingsProviders) page;
|
||||||
|
}
|
||||||
|
|
||||||
|
trackInitialSettings();
|
||||||
|
|
||||||
|
createSashForm();
|
||||||
|
fStatusLine = new StatusMessageLine(usercomp, SWT.LEFT, 2);
|
||||||
|
createBuiltInsCheckBox();
|
||||||
|
// "I want to try new scanner discovery" temporary checkbox
|
||||||
|
createEnableProvidersCheckBox();
|
||||||
|
|
||||||
initButtons(BUTTON_LABELS);
|
initButtons(BUTTON_LABELS);
|
||||||
updateData(getResDesc());
|
updateData(getResDesc());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createSashForm() {
|
|
||||||
sashFormEntries = new SashForm(usercomp,SWT.HORIZONTAL);
|
|
||||||
|
|
||||||
GridData gd = new GridData(GridData.FILL_BOTH);
|
|
||||||
gd.horizontalSpan = 2;
|
|
||||||
gd.grabExcessVerticalSpace = true;
|
|
||||||
sashFormEntries.setLayoutData(gd);
|
|
||||||
|
|
||||||
GridLayout layout = new GridLayout();
|
|
||||||
sashFormEntries.setLayout(layout);
|
|
||||||
|
|
||||||
createTreeForLanguages(sashFormEntries);
|
|
||||||
createTreeForEntries(sashFormEntries);
|
|
||||||
|
|
||||||
sashFormEntries.setWeights(DEFAULT_ENTRIES_SASH_WEIGHTS);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void enableTabControls(boolean enable) {
|
private void enableTabControls(boolean enable) {
|
||||||
sashFormEntries.setEnabled(enable);
|
sashFormEntries.setEnabled(enable);
|
||||||
treeLanguages.setEnabled(enable);
|
treeLanguages.setEnabled(enable);
|
||||||
|
@ -778,16 +780,6 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
||||||
return provider;
|
return provider;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ICLanguageSettingEntry doEdit(ICLanguageSettingEntry ent) {
|
|
||||||
ICLanguageSettingEntry selectedEntry = getSelectedEntry();
|
|
||||||
ICConfigurationDescription cfgDecsription = getConfigurationDescription();
|
|
||||||
LanguageSettingEntryDialog dlg = new LanguageSettingEntryDialog(usercomp.getShell(), cfgDecsription, selectedEntry);
|
|
||||||
if (dlg.open()) {
|
|
||||||
return dlg.getEntries()[0];
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void performEdit(ILanguageSettingsProvider selectedProvider, ICLanguageSettingEntry selectedEntry) {
|
private void performEdit(ILanguageSettingsProvider selectedProvider, ICLanguageSettingEntry selectedEntry) {
|
||||||
if (selectedProvider instanceof ILanguageSettingsEditableProvider && selectedEntry != null) {
|
if (selectedProvider instanceof ILanguageSettingsEditableProvider && selectedEntry != null) {
|
||||||
ICConfigurationDescription cfgDecsription = getConfigurationDescription();
|
ICConfigurationDescription cfgDecsription = getConfigurationDescription();
|
||||||
|
@ -1107,15 +1099,4 @@ providers: for (ILanguageSettingsProvider provider : oldProviders) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Shortcut for setting setting entries for current context.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private void setSettingEntries(ILanguageSettingsEditableProvider provider, List<ICLanguageSettingEntry> entries) {
|
|
||||||
ICConfigurationDescription cfgDescription = getConfigurationDescription();
|
|
||||||
IResource rc = getResource();
|
|
||||||
if (currentLanguageId!=null)
|
|
||||||
provider.setSettingEntries(cfgDescription, rc, currentLanguageId, entries);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2010, 2012 Andrew Gvozdev and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Andrew Gvozdev - Initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.language.settings.providers;
|
package org.eclipse.cdt.internal.ui.language.settings.providers;
|
||||||
|
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -195,7 +195,6 @@ public class Messages extends NLS {
|
||||||
public static String LanguageSettingsProviderTab_Configure;
|
public static String LanguageSettingsProviderTab_Configure;
|
||||||
public static String LanguageSettingsProviderTab_ErrorPerformingDefaults;
|
public static String LanguageSettingsProviderTab_ErrorPerformingDefaults;
|
||||||
public static String LanguageSettingsProviderTab_ProviderOptions;
|
public static String LanguageSettingsProviderTab_ProviderOptions;
|
||||||
// public static String LanguageSettingsProviderTab_Run;
|
|
||||||
public static String LanguageSettingsProviderTab_SettingEntries;
|
public static String LanguageSettingsProviderTab_SettingEntries;
|
||||||
public static String LanguageSettingsProviderTab_SettingEntriesTooltip;
|
public static String LanguageSettingsProviderTab_SettingEntriesTooltip;
|
||||||
public static String LanguageSettingsProviderTab_ShowEntries;
|
public static String LanguageSettingsProviderTab_ShowEntries;
|
||||||
|
|
|
@ -174,7 +174,6 @@ LanguageSettingsProviderTab_Clear=Clear Entries
|
||||||
LanguageSettingsProviderTab_Configure=Configure
|
LanguageSettingsProviderTab_Configure=Configure
|
||||||
LanguageSettingsProviderTab_ErrorPerformingDefaults=Error restoring defaults for language settings providers
|
LanguageSettingsProviderTab_ErrorPerformingDefaults=Error restoring defaults for language settings providers
|
||||||
LanguageSettingsProviderTab_ProviderOptions=Language Settings Provider Options
|
LanguageSettingsProviderTab_ProviderOptions=Language Settings Provider Options
|
||||||
#LanguageSettingsProviderTab_Run=Run
|
|
||||||
LanguageSettingsProviderTab_SettingEntries=Setting Entries
|
LanguageSettingsProviderTab_SettingEntries=Setting Entries
|
||||||
LanguageSettingsProviderTab_SettingEntriesTooltip=Setting Entries
|
LanguageSettingsProviderTab_SettingEntriesTooltip=Setting Entries
|
||||||
LanguageSettingsProviderTab_ShowEntries=Show Entries
|
LanguageSettingsProviderTab_ShowEntries=Show Entries
|
||||||
|
|
Loading…
Add table
Reference in a new issue