AI 144095: am: CL 144049 am: CL 144048 ADT #1743364: Uncomment the system resource chooser code.
Rationale: we want to keep that code around, so we need to compile it to make sure it doesn't use obsoleted APIs. That does it. Original author: raphael Merged from: //branches/cupcake/... Original author: android-build Merged from: //branches/donutburger/... Automated import of CL 144095
This commit is contained in:
committed by
The Android Open Source Project
parent
a5370e95c4
commit
57392cb174
@@ -20,6 +20,10 @@ import com.android.ide.eclipse.common.resources.IResourceRepository;
|
|||||||
import com.android.ide.eclipse.common.resources.ResourceItem;
|
import com.android.ide.eclipse.common.resources.ResourceItem;
|
||||||
import com.android.ide.eclipse.common.resources.ResourceType;
|
import com.android.ide.eclipse.common.resources.ResourceType;
|
||||||
|
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
|
import org.eclipse.swt.widgets.Button;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Control;
|
import org.eclipse.swt.widgets.Control;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
@@ -39,11 +43,11 @@ public class ResourceChooser extends AbstractElementListSelectionDialog {
|
|||||||
|
|
||||||
private IResourceRepository mProjectResources;
|
private IResourceRepository mProjectResources;
|
||||||
|
|
||||||
// TODO: enable when we can display the system resources.
|
private final static boolean SHOW_SYSTEM_RESOURCE = false; // TODO re-enable at some point
|
||||||
// private Pattern mSystemResourcePattern;
|
private Pattern mSystemResourcePattern;
|
||||||
// private IResourceRepository mSystemResources;
|
private IResourceRepository mSystemResources;
|
||||||
// private Button mProjectButton;
|
private Button mProjectButton;
|
||||||
// private Button mSystemButton;
|
private Button mSystemButton;
|
||||||
|
|
||||||
private String mCurrentResource;
|
private String mCurrentResource;
|
||||||
|
|
||||||
@@ -60,14 +64,15 @@ public class ResourceChooser extends AbstractElementListSelectionDialog {
|
|||||||
|
|
||||||
mResourceType = type;
|
mResourceType = type;
|
||||||
mProjectResources = project;
|
mProjectResources = project;
|
||||||
// TODO: enable when we can display the system resources.
|
|
||||||
// mSystemResources = system;
|
|
||||||
|
|
||||||
mProjectResourcePattern = Pattern.compile(
|
mProjectResourcePattern = Pattern.compile(
|
||||||
"@" + mResourceType.getName() + "/(.+)"); //$NON-NLS-1$ //$NON-NLS-2$
|
"@" + mResourceType.getName() + "/(.+)"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
// TODO: enable when we can display the system resources.
|
|
||||||
// mSystemResourcePattern = Pattern.compile(
|
if (SHOW_SYSTEM_RESOURCE) {
|
||||||
// "@android:" + mResourceType.getName() + "/(.+)"); //$NON-NLS-1$ //$NON-NLS-2$
|
mSystemResources = system;
|
||||||
|
mSystemResourcePattern = Pattern.compile(
|
||||||
|
"@android:" + mResourceType.getName() + "/(.+)"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
}
|
||||||
|
|
||||||
setTitle("Resource Chooser");
|
setTitle("Resource Chooser");
|
||||||
setMessage(String.format("Choose a %1$s resource",
|
setMessage(String.format("Choose a %1$s resource",
|
||||||
@@ -89,8 +94,7 @@ public class ResourceChooser extends AbstractElementListSelectionDialog {
|
|||||||
ResourceItem item = (ResourceItem)elements[0];
|
ResourceItem item = (ResourceItem)elements[0];
|
||||||
|
|
||||||
mCurrentResource = mResourceType.getXmlString(item,
|
mCurrentResource = mResourceType.getXmlString(item,
|
||||||
// TODO: enable when we can display the system resources.
|
SHOW_SYSTEM_RESOURCE && mSystemButton.getSelection());
|
||||||
false /*mSystemButton.getSelection()*/);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,9 +104,7 @@ public class ResourceChooser extends AbstractElementListSelectionDialog {
|
|||||||
|
|
||||||
createMessageArea(top);
|
createMessageArea(top);
|
||||||
|
|
||||||
// TODO: enable when we can display the system resources.
|
createButtons(top);
|
||||||
// createButtons(top);
|
|
||||||
|
|
||||||
createFilterText(top);
|
createFilterText(top);
|
||||||
createFilteredList(top);
|
createFilteredList(top);
|
||||||
|
|
||||||
@@ -115,8 +117,10 @@ public class ResourceChooser extends AbstractElementListSelectionDialog {
|
|||||||
* Creates the radio button to switch between project and system resources.
|
* Creates the radio button to switch between project and system resources.
|
||||||
* @param top the parent composite
|
* @param top the parent composite
|
||||||
*/
|
*/
|
||||||
/* TODO: enable when we can display the system resources.
|
|
||||||
private void createButtons(Composite top) {
|
private void createButtons(Composite top) {
|
||||||
|
if (!SHOW_SYSTEM_RESOURCE) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
mProjectButton = new Button(top, SWT.RADIO);
|
mProjectButton = new Button(top, SWT.RADIO);
|
||||||
mProjectButton.setText("Project Resources");
|
mProjectButton.setText("Project Resources");
|
||||||
mProjectButton.addSelectionListener(new SelectionAdapter() {
|
mProjectButton.addSelectionListener(new SelectionAdapter() {
|
||||||
@@ -136,7 +140,6 @@ public class ResourceChooser extends AbstractElementListSelectionDialog {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setups the current list based on the current resource.
|
* Setups the current list based on the current resource.
|
||||||
@@ -147,12 +150,13 @@ public class ResourceChooser extends AbstractElementListSelectionDialog {
|
|||||||
ResourceItem[] items = mProjectResources.getResources(mResourceType);
|
ResourceItem[] items = mProjectResources.getResources(mResourceType);
|
||||||
setListElements(items);
|
setListElements(items);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* TODO: enable when we can display the system resources.
|
if (SHOW_SYSTEM_RESOURCE) {
|
||||||
if (setupInitialSelection(mProjectResourcePattern, mProjectResources) == false) {
|
if (setupInitialSelection(mProjectResourcePattern, mProjectResources) == false) {
|
||||||
if (setupInitialSelection(mSystemResourcePattern, mSystemResources) == false) {
|
if (setupInitialSelection(mSystemResourcePattern, mSystemResources) == false) {
|
||||||
// if we couldn't understand the current value, we default to the project resources
|
// if we couldn't understand the current value,
|
||||||
IResourceItem[] items = mProjectResources.getResources(mResourceType);
|
// we default to the project resources
|
||||||
|
ResourceItem[] items = mProjectResources.getResources(mResourceType);
|
||||||
setListElements(items);
|
setListElements(items);
|
||||||
mProjectButton.setSelection(true);
|
mProjectButton.setSelection(true);
|
||||||
} else {
|
} else {
|
||||||
@@ -160,7 +164,8 @@ public class ResourceChooser extends AbstractElementListSelectionDialog {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mProjectButton.setSelection(true);
|
mProjectButton.setSelection(true);
|
||||||
}*/
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user